wzq 5 éve
szülő
commit
c12dcf3d62
1 módosított fájl, 5 hozzáadás és 0 törlés
  1. 5 0
      app/Repositories/BeanRepository.php

+ 5 - 0
app/Repositories/BeanRepository.php

@@ -2,6 +2,7 @@
 namespace App\Repositories;
 use App\Models\Post;
 use App\Traits\PostTrait;
+use App\Traits\UserTrait;
 use Illuminate\Support\Carbon;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Log;
@@ -10,6 +11,7 @@ use Illuminate\Support\Facades\Redis;
 class BeanRepository
 {
     use PostTrait;
+    use UserTrait;
     public function beanDetail($request)
     {
         try {
@@ -249,9 +251,12 @@ class BeanRepository
         if (isset($request['post_id']) && $request['post_id']){
             $post = $this->getPostInfo($request['post_id'], 1);
             if ($post){
+                $user = $this->userInfo($post['uid']);
                 $topic = $this->getTopic($post['topic_ids']);
                 $post['created_time'] = Carbon::parse($post['created_at'])->diffForHumans();
                 $post['topic'] = array_column($topic, 'name');
+                $post['username'] = $user['username'];
+                $post['avatar'] = $user['avatar'];
                 $star_detail['post'] = $post;
             }else{
                 Log::debug($request['post_id']);