TIS2023-FMFI / pracovne-cesty

Projekt TIS 2023 pre Katedru aplikovanej informatiky
The Unlicense
2 stars 0 forks source link

Permissions and auth middlewares #82

Closed Mcibula closed 9 months ago

Mcibula commented 10 months ago

config/permission.php a migrations/2024_01_28_012937_create_permission_tables.php su automaticky generovane, netreba mat strach.

Mcibula commented 10 months ago

Zatial takto asi. Rychly tutorial k user roles:

// Is user logged-in?
Auth::check();

//  Does the currently logged-in user has role ...?
Auth::user()->hasRole('...');

// Get role name of the logged-in user
Auth::user()->getRoleNames();

// The same as above for an arbitrary user in the DB
$user->hasRole('...');
$user->getRoleNames();