Question By
Solved

How can I display only the data of the currently logged-in user who added this? 

Solved
cpshibinoppo

Nov 30th, 2022 02:49 AM

How can I display only the data of the currently logged-in user who added this? 

bobbyiliev

Nov 30th, 2022 02:52 AM

Best Answer

Hi there,

You can do this by using the auth()->user() helper function, for example to get the posts for the currently authenticated user you could do the following:

$user = auth()->user();
$allpost = $user->posts()->get();
var_dump($allpost);

If you are referring to Voyager, then you could od that by following the steps here:

How to apply multi-tenancy in Laravel Voyager

Report
1