andriajah Sat Jun 2023 1 year ago

Roles and Permissions in Laravel Jetstream (Inertia.js) - Space Package

How to implement Roles and permissions in a Laravel Jetstream project (Inertiajs). Use the Spatie package to implement roles and permissions in your Laravel project.

Written guide: https://codingoblin.com/roles-and-permissions-in-laravel-jetstream-inertiajs-using-spatie-package/

How to use Roles and Permissions in Laravel Jetstream (Inertiajs) using the Spatie Package
Using roles and permissions in Laravel can seem daunting at first. But when you break it down step by step its actually a very simple process.

Whats included in this example?
In this example we are going to create 2 roles.

‘admin’ role
‘standard’ role
We are then going to create 4 permissions.

‘write articles’
‘read articles’
‘edit articles’
‘delete articles’
We will then assign these permissions to the relevant roles. The ‘admin’ role will have all 4 permissions, while the ‘standard’ role will only have the ‘read articles’ role. We will then assign the roles to users within our application. Finally we will look at how to display content within our application based on the permissions held by the currently authenticated user. It sounds like a lot but it’s very simple when you break it down!