lundi 30 mars 2020

Laravel Spatie Get All Permissions with Eager Loading

everybody! I am using Laravel Spatie Permission Package. And I can get user's all assigned permissions like this.

$user->getAllPermissions()

However, I want to get all permissions with eager loading. Maybe like this.

$users = User::with('getAllPermissions')->get();

But this didn't worked.

I tried

$users = user::with('permissions')->get();

But query counts were same result with

$users = user::get();

So $user->getAllPermissions() is already eager loaded query?

Or is there any eager loaded query?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire