My Blog Posts

Laravel Permissions Pack

Laravel Permissions Pack

Maravel Permissions is a package by Inani El Houssain that provides permissions on Laravel using a super user. This package helps you give users capabilities.

Because each user deserves to be a user, the Maravel API is based on the super user:

Having a user
$user = User::first();
// Create a new marvel
$storm = Spectre::create('storm')-havingPower([
// we can grant a power to it
$storm = Spectre::of($storm)->grant('flying');
// Or take it off
$storm = Spectre::of($storm)->takeOff('see_the_future');
// bless the user with the abilities of the marvel
// Check if it has the ability
// Check if it has one of the provided abilities
// make it human again (remove its role)

Also, an example of how to manage instances directly:

Create Ability
$ability = Ability::create([
'super_power' => 'speed'
// Create a Marvel
$marvel = Marvel::create([
'name' => 'Cristiano Ronaldo'
// Grant the ability
// remove a certain ability
$marvel-$ability takeOff;
// remove all and keep only those
// bless it to our user

You can learn more about this package, get all setup instructions, and see the source code on GitHub at akiyamaSM/maravel-permissions.

Share this article

Comments (0)