Spatie package allows us to manage user related roles and permission. The assigned roles and permissions are stored in the model_has_roles and model_has_permissions table.
Install Spatie package with composer
composer require spatie/laravel-permission
Commands to assign a role to the user with terminal
- Run php artisan tinker command in the laravel project root directory
- Fetch the user detail to whom you want to assign a role.
$user = App\User::with('roles')->where('email','TestMan@mailinator.com')->first();
- Run command to assign role TitleContractor
$user->assignRole('TitleContractor')
- Remove role from user with command
$user->removeRole('TitleContractor')
jQuery presents a tree-like structure of all the elements on a webpage simplifying the syntax and further manipulating such elements. The jQuery Certification Exam by StudySection will secure your fundamental knowledge and a basic understanding of jQuery as an asset to improve your skills.