Next on our list - separating user roles. In our system, we need admins to manage the system settings and employees, while the employees themselves can only manage customers and nothing else:
In this lesson, we will do the following:
- Create roles Model and Database structure
- Create a user management page (CRUD)
- Add employees to our Customers' table and form for admins to manage
- Add employee changes to our customer history
- Add an additional tab in Customers for
My Customers
- customers assigned to the employee
Creating Roles Model and Database structure
Let's start by creating our migration file:
Migration
Schema::create('roles', function (Blueprint $table) { $table->id(); $table->string('name'); $table->timestamps();});
Then, we can fill out our Model:
app/Models/Role.php
class Role extends Model{ protected $fillable = ['name'];}
Of course, we should also...