Как я могу использовать функции модели в уведомлениях laravel?
я хочу использовать эту функцию:
public function isFollowed()
{
return $this->followers()
->where('follower_id', auth()->id())->exists();
}
я получаю следующую ошибку: Call to a member function isFollowed() on array
Этомой текущий код:
<a class="@if($notification->read_at)@else unread-notification @endif min-height-60" href="#">
<img class="rounded mt-5" src="{{ Storage::url( $notification->data['user']['avatar'] ) }}" width="45" height="45" alt="" />
<small class="float-right" style="color:#666">{{$notification->created_at->diffForHumans()}}</small>
<h5 class="fs-11 text-black mt-10 mb-0"><b>@if( Auth::id() == $notification->data['user']['id'] OR $notification->data['profile']['privacy'] == 1 OR $notification->data['profile']['privacy'] == 2 OR $notification->data['user']->isFollowed(Auth::id()) ){{$notification->data['user']['username']}}@else AC @endif</b> hat dein Post kommentiert: <b>{!! $notification->data['comment']['body'] !!}</b></h5>
</a>
если я использую
$notification->data['user']['id']->isFollowed(Auth::id())
Тогда я получаю следующую ошибку:
Call to a member function isFollowed() on integer