Skip to content

Laravel Multiple Roles and Permission With Product Module and Order Module

Notifications You must be signed in to change notification settings

tejassoni/laravel-multiple-roles-permission

Repository files navigation

Overview

Laravel multiple roles with permission management system. SuperAdmin can able to manage other roles permissions. So, other roles can able access any module create, read, update and delete functionality on basis of permission given. using Spatie/laravel-permission package.

Server Requirements

Project Requirement

  • Basic Laravel Auth: ability to log in with below Roles
    1. SuperAdmin (Can manage Products, Orders, Administrators, Members)
    2. Administrator ( Can manage Products, Orders, Members)
    3. Member (Can create multiple Order)
  • Use database seeders to create SuperAdmin with email "[email protected]" and password "superadmin@123"
  • Use database seeders to create Administrator with email "[email protected]" and password "admin@123"
  • Use basic Laravel resource controllers with default methods - index, create, store, show etc.
  • Product Module CRUD fields
  • Product Name : [ Validation Rules : Accept only strings and space, Required ]
  • Product Image : [ Validation Rules : Accept only png and jpg, Maximum 5 mb size, Required ]
  • Product Description :
  • Product Price : [ Validation Rules : Accept only double numbers, Required ]
  • Product Stock/Qty : [ Validation Rules : Accept only numbers, Maximum lenght 9, Required ]
  • Order Module CRUD fields
  • Order Id :
  • Multiple Product Select :
  • Total Amount: [Auto Fetch price base on products selection]

Laravel / PHP Coding Standards

  1. Use Laravel's migration scripts for database schema and tables related to further all operations
  2. Use Laravel's factory and seeders for sample dummy data creations where required
  3. Use Laravel's validation using Request classes where required
  4. Use Laravel's Eloquent and Relationships in models where required
  5. Use camel case for function name and variable name. E.g getProductDetails() , $categoryDetails
  6. Comment on the above function with short details of that function use or purpose of function creation.
  7. Reuse the common codes using some helper class functions etc
  8. Remove unnecessary code and debug points that are not needed
  9. Avoid unnecessary loops if not required
  10. Avoid unnecessary variable creations
  11. Use PHP design patterns where required Design Patterns
  12. Normalize database tables where required Database Normalization
  13. Optimize database tables
  14. Avoid MySQL joins queries if not required
  15. Avoid MySQL sub queries if it does not require
  16. For more information, please read the document Code Standard

References

  1. https://www.itsolutionstuff.com/post/laravel-10-user-roles-and-permissions-tutorialexample.html
    1. Search Key

      1. KEY : MULTIPERMISSION