#29 Laravel 10 Tutorial | Roles and Permissions in Laravel (V) | Set Permissions for Sub Admins

Опубликовано: 01 Январь 1970
на канале: Stack Developers
1,868
20

►Laravel 10 Tutorial Playlist:    • Laravel 10 Tutorial: Make Admin Panel...  

In Part-29, we will continue working on Sub-Admins Roles and Permissions. In this video, we will create an admins_roles table and will create a roles and permissions form for Subadmins to activate and deactivate the access for the modules like we have done the CMS Pages module so far so we will give View/Edit and Full access for it for every sub-admin that admin will grant.

1) Create admins_roles table :-
First of all, create admins_roles table with below columns :-
admin_id, module, view_access, edit_access, full_access, created_at, updated_at

admin_id - id of admin, sub admin or super admin
module - categories, products etc.
view_access - for view only
edit_access - for view and edit
full_access - for view, edit and delete

1.1) Run below command to make migration file :-
php artisan make:migration create_admins_roles_table

1.2) Update migration file to add columns in admins_roles table :-

1.3) Run below command :-
php artisan migrate

Now, admins_roles table has been created.

2) Create AdminRole Model :-
Create AdminRole Model with below artisan command :-
php artisan make:model AdminRole

3) Update subadmins.blade.php file :-
Add update-role link at subadmins page for setting the permission for subadmin.

4) Create Route :-
Now create GET/POST route for update roles/permissions for sub admins in web.php file :-
Route::match(['get','post'],'/update-role/{id}','AdminController@updateRole');

5) Create updateRole function :-
Now create updateRole function at AdminController return to update_roles.blade.php file that we will create in next step.

6) Create update_roles.blade.php file :-
Now create update_roles.blade.php file under \resources\views\admin\subadmins\ folder in which we will add cms pages add/edit/full access as this is the only module we have created so far.

7) Update updateRole function :-
Now we will update updateRole function to get the posted data and update view/edit/full access for categories, products, coupons and other modules for admins and subadmins.

We will make admin/subadmin roles/permissions empty first before assigning new permissions.

To be continued...

►Click here to subscribe for Laravel & other updates -    / stackdevelopers  

Popular Stack Developers Series that can help you:-

►Laravel Multi-Vendor E-commerce Website -    • Laravel Multi Vendor Tutorial  

►React JS Tutorial for Beginners with Laravel -    • React JS Tutorial with Laravel for Be...  

►Laravel Tutorial for Beginners -    • Laravel Tutorial for Beginners | Adva...  

►GIT Tutorial for Beginners -    • Git Tutorial for Beginners | Create y...  

►Laravel API Tutorial -    • Laravel API Tutorial | Create API fro...  

►Laravel Interview Questions -    • Laravel Interview Questions & Answers...  

►jQuery Tutorial -    • jQuery Tutorial  

►Laravel Basic E-commerce Series -    • Make Admin Panel / E-commerce Website...  

►Laravel Dating Series -    • Make Dating / Social Networking Websi...  

►Join this channel to get the complete source code of all series:
   / @stackdevelopers  

Follow Stack Developers on Social Media to get updates and resolve your queries
►Like Facebook Page to get updates -   / stackdevelopers2  
►Join Facebook Group to resolve your queries -   / stackdevelopers  
►Follow on Instagram -   / stackdevelopers2  
►Follow on GitHub - https://github.com/stackdevelopers

#laravel10 #laravel10tutorial #laravel


Смотрите видео #29 Laravel 10 Tutorial | Roles and Permissions in Laravel (V) | Set Permissions for Sub Admins онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Stack Developers 01 Январь 1970, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,86 раз и оно понравилось 2 людям.