Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here
Premium Members Only
Join to unlock this tutorial and all of our courses.
Tutorial Premium Tutorial

Laravel Inertia Roles & Permissions: Breeze/Jetstream Examples

September 23, 2022
15 min read

Tutorial last revisioned on January 27, 2025 with Laravel 11 and Vue.js 3

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?

Laravel Breeze & Jetstream Inertia: Roles & Permissions


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...

Premium Members Only

This advanced tutorial is available exclusively to Laravel Daily Premium members.

Premium membership includes:

Access to all premium tutorials
Video and Text Courses
Private Discord Channel

Comments & Discussion

BW
bokele wakiza franck ✓ Link copied!

How to install vue with Jetstream without using Inertia in ?

PK
Povilas Korop ✓ Link copied!

I don't think it's possible, Jetstream has the Vue version specifically with Inertia. If you want pure Vue, you shouldn't/can't use Jetstream.

MH
Mahmudul Haque ✓ Link copied!

is it possible to create a short video about loadMissing()? I do not understand, how does actually work.

thank you

Y
Yaser ✓ Link copied!

If I want to grant access to pages, how should I proceed?

M
Modestas ✓ Link copied!

You need to:

  1. Add a check that a role/permission is granted for the user. This would be in your controller as the first method.
  2. In navigation display - surround the item with @can() and @endcan to conditionally show them

This is probably the easiest way to achieve this

Y
Yaser ✓ Link copied!

Modestas, Wouldn't it be better to define a dedicated middleware to check user access to the page and then add it in the route section? My goal is to be able to use 'Gate' for two purposes:

  1. Permission for actions (Insert button, delete button, edit button)
  2. Permission for accessing pages

How can I achieve this?

M
Modestas ✓ Link copied!

Middleware is okay to create, but can be complex.

The other two ways you have defined - sound like gates/policies. In that case, I would strongly recommend using https://spatie.be/docs/laravel-permission/v6/introduction as it already contains all the features for you automatically!

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.