Загрузка...

Laravel 12 Multi-Vendor E-commerce #15 | Roles & Permissions (I) | Display Subadmins in Admin Panel

🔗Laravel 12 Multi-Vendor E-commerce Series Complete Playlist:
https://www.youtube.com/playlist?list=PLLUtELdNs2ZZ_hI7DvqrrhX-ASGD1U2Dl

Welcome to Part 15 of the Laravel 12 Tutorial Series where we are building a Multi-Vendor E-commerce Website.

In this part, we will start working on Subadmin Roles and Permissions for the Laravel 12 Admin Panel.

This feature will allow the admin to add sub-admins with specific roles and permissions, enabling better access control for e-commerce modules.

For example, one sub-admin can handle user roles, another can manage order roles, or some sub-admins can have both permissions. The super admin will retain full control over all roles and permissions.

🔥 What We’ll Cover in This Part:

✅ Seeding Subadmins in the Admins Table – We'll update the AdminsTableSeeder file to insert multiple sub-admins into the database.

✅ Displaying Subadmins in the Admin Panel – We'll display the Sub-admins in the Admin Panel.

🚀 Step 1: Seeding Subadmins in the Admins Table
We'll update the AdminsTableSeeder.php file to insert multiple sub-admins into the database and comment out the existing admin query.

🔸 Update AdminsTableSeeder.php

🚀 Step 2: Update Seeder Class
Update DatabaseSeeder.php to call the AdminsTableSeeder class and seed the database.

🔸 Update DatabaseSeeder.php

🔸 Run Seeder Command
Use the following command to seed the new sub-admin records into the admins table:
php artisan db:seed --class=AdminsTableSeeder

🚀 Step 3: Display Subadmins in the Admin Panel
We will update the sidebar, create routes, and display subadmins in the admin panel using the following steps:

🔸 Update sidebar.blade.php
Add a Subadmin module to the admin sidebar (visible only to admins):

🚀 Step 4: Create Route
Create a GET route for displaying subadmins:

🔸 Update web.php

🚀 Step 5: Create subadmins Function in AdminService
Write a query to select all subadmins from the admins table and return them to the controller.

🔸 AdminService.php

🚀 Step 6: Create subadmins Function in AdminController
Call the subadmins function from AdminService and pass the data to the view.

🔸 AdminController.php

🚀 Step 7: Create subadmins.blade.php
Create a subadmins.blade.php file by following these steps:

1. Create a subadmins folder under \resources\views\admin\.
2. Create a subadmins.blade.php file inside the subadmins folder.
3. Add content from the AdminLTE template simple.html file located in the /dist/pages/tables/simple.html folder.
4. Use a foreach loop to display the list of sub-admins, including their ID, Name, Mobile, Email, and Actions.

🔸 subadmins.blade.php

🚀 Next Part
✅ In the next part, we will implement Active/Inactive status and Delete functionality for subadmins.

📢 Don’t forget to Like, Share & Subscribe for more Laravel tutorials! 🚀

🔗Bookmark & follow this Laravel 12 Multi-Vendor E-commerce Series:
https://www.youtube.com/playlist?list=PLLUtELdNs2ZZ_hI7DvqrrhX-ASGD1U2Dl

►Click here to subscribe for Laravel & other updates - https://www.youtube.com/stackdevelopers

Popular Stack Developers Series that can help you:-

►Laravel 12 Tutorial (with MySQL): https://www.youtube.com/playlist?list=PLLUtELdNs2ZbqkUOd-oXHemay3BrsqZqC

►Laravel 11 Tutorial (with MongoDB): https://www.youtube.com/playlist?list=PLLUtELdNs2ZYTn3ft4BMaAilhZJYLMs9d

►Laravel 11 PostgreSQL Tutorial: https://www.youtube.com/playlist?list=PLLUtELdNs2ZZy4jI-wu4jYUL7rbvC8Mgh

►Laravel API Tutorial - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbcCsd4yAAiBU2L3ROREk8P

►jQuery Tutorial - https://www.youtube.com/playlist?list=PLLUtELdNs2ZbMYoUA46GIonOH29KcjtxA

►Laravel Basic E-commerce Series - https://www.youtube.com/playlist?list=PLLUtELdNs2ZY5drPxIWzpq5crhantlzp7

►Laravel Dating Series - https://www.youtube.com/playlist?list=PLLUtELdNs2ZZrPUnxjlomErJfNvkyS6Hf

►Join this channel to get the complete source code of all series:
https://www.youtube.com/channel/UCExO2i-tLU1NyVZD6zOJQlw/join

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

#Laravel12 #LaravelEcommerce #MultiVendor #EcommerceDevelopment #WebDevelopment #LaravelTutorial

Видео Laravel 12 Multi-Vendor E-commerce #15 | Roles & Permissions (I) | Display Subadmins in Admin Panel канала Stack Developers
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки