Finally, in this course, we will take care of permission. In this lesson, we will take care of the back-end part. We will create Role and Permission models. Then we will add two roles: admin and editor. The admin role will be able to do everything and the editor will not be able to delete the posts.

First, we will create the models with migrations for roles and permissions.
php artisan make:model Role -mphp artisan make:model Permission -m
database/migrations/xxxx_create_roles_table.php:
public function up(): void{ Schema::create('roles', function (Blueprint $table) { $table->id(); $table->string('name'); $table->timestamps(); });}
app/Models/Role.php:
class Role extends Model{ protected $fillable = ['name'];}
database/migrations/xxxx_create_permissions_table.php:
public function up(): void{ Schema::create('permissions', function (Blueprint $table) { $table->id(); $table->string('name'); $table->timestamps(); });}
app/Models/Permission.php:
class permissions extends Model{ protected $fillable = ['name'];}
Next, we need to create a pivot table for...