Download the PHP package lewis15520/lararoles without Composer
On this page you can find all versions of the php package lewis15520/lararoles. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lewis15520/lararoles
More information about lewis15520/lararoles
Files in lewis15520/lararoles
Package lararoles
Short Description A roles and permissions system for laravel
License mit
Informations about the package lararoles
Lararoles - Work In Progress
A package to add roles and permissions to laravel
Requirements
- PHP 7.3 or later
- Laravel 8 or later
Installation
In order to run Lararoles you are required to follow these steps in your terminal
- Install the package with
- Copy the required package conents with
- Install the package migrations with
Usage
Adding the trait
In your model, add the following lines in the cases: . Then, inside the class, above the functions, add the following:
Checking the roles and permissions
Anywhere around the application where you have a user object (including from the helper), you can add attach a series of functions to check roles and permissions.
-
hasRole: Usage "" | Definition "This will check for a singular role attached to this user."
-
hasRoles: Usage "" | Definition "This will check if atleast one of the roles given is attached to the user, unless the variable is set to , then it will only pass if all the roles are attached to the user."
-
hasPermission: Usage "" | Definition "This will check for a singular permission attached to this user through their attached roles."
- hasPermissions: Usage "" | Definition "This will check if atleast one of the permissions given is attached to one of the roles that the user is assigned to, unless the variable is set to , then it will only pass if all the permissions are associated."