Laravel has a few starter kits like Breeze and Jetstream, but they don't have roles/permissions functionality. This time, let's talk specifically about Vue Inertia versions of those starter kits: how to add the roles and permissions there?
Before we get to the roles and permissions, we will prepare the actual project with the data structure and Inertia CRUD. So, let's go step-by-step.
Preparation Step 1: Install Breeze Inertia
First, we will take a look at Laravel Breeze implementation, and at the end of the article, we will touch on Jetstream, which will be really similar.
So, after creating a fresh Laravel project, we install Breeze:
composer require laravel/breeze --dev
Then we use Breeze scaffolding with Vue version specifically:
php artisan breeze:install vue npm run dev
Preparation Step 2: Tasks CRUD
For using permissions, let's create a simple Tasks CRUD. The command below will create a Model, Migrations, and Controller:
php artisan make:model Task -mc
For migration, let's add only one field for the description
public function up() { Schema::create('tasks', function (Blueprint $table) { $table->id(); $table->text('description'); $table->timestamps(); }); }
Don't forget to add the description
field to...