Answer the question
In order to leave comments, you need to log in
How can I separate myself from other users in the controller?
Please tell me how to separate myself and other users of the site (which will be enclosed in the $friend variable). In the task condition, there is me $user and there are others $friend.
I found only $user = Auth::user(); to refer to myself in Laravel. but this applies to everyone. Is there a more precise command?
I need this to run this code:
$users = User::all();
$user = Auth::user();
$friend = ??? (хз что тут писать)
$last_message = Chat::select(['chat'])->where('user_id', $user->id)->where('friend_id', $friend->id)->orderBy('id', 'desc')->first();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question