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