Laravel E-com | Admins/Subadmins Roles/Permissions (II) | Add/Edit Admins/Subadmins from Admin Panel

Published: 01 January 1970
on channel: Stack Developers
836
16

In Part-182 of Advance E-commerce Series, we will continue working on Admins/Sub-Admins Roles and Permissions.

In this video, we will work on add/edit functionality for admins / sub-admins in the admin panel.

1) Create Route :-
First of all, create GET/POST route for adding/editing admin/subadmin in web.php file :-
Route::match(['get','post'],'add-edit-admin-subadmin/{id?}','AdminController@addEditAdminSubadmin');

2) Create addEditAdminSubadmin function :-
Now create addEditAdminSubadmin function at AdminController which will work for both add and edit. When admin/subadmin id return then it will work for edit otherwise add admin/subadmin.

3) Create add_edit_admin_subadmin.blade.php file :-
Now create add_edit_admin_subadmin.blade.php file under \resources\views\admin\admins_subadmins\ folder in which we will display add/edit admin/subadmin form with admin name, email, type, password, mobile and image.

4) Update addEditAdminSubadmin function :-
Now update addEditAdminSubadmin function to add/edit admin/subadmin details in admins table and return back to admins/subadmins page. In case admin/subadmin already exists in case of add then we will return with error message.

5) Update admin_sidebar.blade.php file :-
Add condition to show Admin/Subadmin module in case of superadmin or admin, not sub admin.

6) Update adminsSubadmins function :-
Update adminsSubadmins function to add condition to redirect to dashboard in case of subadmin type.

7) Update login function :-
Update login function at AdminController to check if admin/subadmin is active or inactive. We allow to login if status of admin/subadmin is 1.

Now try adding admins/subadmins from admin panel and try to access admin panel by logging with them.

In next video, we will start working on roles and permissions for admins/subadmins.

Join this channel to get complete code/support :-
   / @stackdevelopers  


Watch video Laravel E-com | Admins/Subadmins Roles/Permissions (II) | Add/Edit Admins/Subadmins from Admin Panel online without registration, duration hours minute second in high quality. This video was added by user Stack Developers 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 836 once and liked it 16 people.