Вот как выглядит мой метод:
public function show(Game $game)
{
$discussion = DB::table('chatter_post')->whereId($game->chatter_post_id)->first();
$chatter_post = DB::table('chatter_post')->where('chatter_discussion_id', $discussion->chatter_discussion_id)
->whereNotIn('id', [$game->chatter_post_id])->get();
dd($chatter_post);
return view('games.games', ['game' => $game, 'discussions' => $chatter_post]);
}
Я могу видеть все данные, когда я выкидываю и умираю в dd ($ chatter_post):
0 => {#861 ▼
+"id": 20
+"chatter_discussion_id": 25
+"user_id": 1
+"body": "<p>Everything will be placed here</p>"
+"created_at": "2018-11-28 08:10:39"
+"updated_at": "2018-11-28 08:10:39"
+"markdown": 0
+"locked": 0
+"deleted_at": null
}
Но винтерфейс, когда я пытаюсь использовать diffForHumans, я вижу эту ошибку:
Call to a member function diffForHumans() on string
Вот так выглядит мой интерфейс:
@foreach($discussions as $discussion)
<div class="flex">
<div class="avatar"></div>
<blockquote class="main_content">
<p class="author_created">Author Name {{$discussion->created_at->diffForHumans()}} </p>
<div>{!!$discussion->body!!}</div>
</blockquote>
</div>
@endforeach
Почему я получаю ошибку, когдаЯ вызываю getDIffForHumans?