Download the PHP package andrey-helldar/laravel-roles without Composer

On this page you can find all versions of the php package andrey-helldar/laravel-roles. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-roles

Laravel Basic Roles and Permissions

Basic roles and permissions handling for Laravel 5.5 and up.

laravel roles

This package is abandoned and no longer maintained. The author suggests using the spatie/laravel-permission package instead.

StyleCI Status Github Workflow Status Coverage Status Scrutinizer Code Quality For Laravel

Stable Version Unstable Version Total Downloads

Contents

Installation

If you upgrade from the old version, you can see the list of changes in the Upgrade Guide:

  • Upgrading To 2.x From 1.x

To get the latest version of Laravel Roles, simply require the project using Composer:

Or manually update require block of composer.json and run composer update.

Now you can publish the configuration and migration file by running the command:

You can create the DB tables by running the migrations:

This command will create such roles, permissions, user_role and role_permission tables.

Using

User model

First, add the Helldar\Roles\Traits\HasRoles trait to your User model:

Middleware

You can add middlewares in $routeMiddleware of app/Http/Kernel.php file:

Now you can check if one of the conditions is met:

Or check the entry of all conditions:

Creating

Assign, revoke and sync permissions

This package allows for users to be associated with permissions and roles. Every role is associated with multiple permissions. A Role and a Permission are regular Eloquent models.

Assign permissions

To add roles and permissions, use the following methods:

Revoke permissions

To revoke roles and permissions, use the following methods:

Syncing permissions

To synchronization roles and permissions, use the following methods:

Blade

If you enabled the use of directives in the config file, you can still using can() blade directive with additional role() and permission() directives:

You can only use blade directives with role/permission id or slug.

Note: use @can(), @role(), @roles(), @permission() and @permissions() directives is enabling separately. See config file.

Checking for permissions

A root role:

user » role:

user » roles:

user » permission:

user » permissions:

role » permission:

role >> permissions:

Artisan commands

You can create/delete a role or a permission from a console with artisan commands:

You can also invoke the creation of roles and permissions from your application:

License

This package is released under the MIT License.


All versions of laravel-roles with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3|^8.0
doctrine/dbal Version ^2.6
illuminate/auth Version ^5.5|^6.0|^7.0|^8.0
illuminate/cache Version ^5.5|^6.0|^7.0|^8.0
illuminate/console Version ^5.5|^6.0|^7.0|^8.0
illuminate/contracts Version ^5.5|^6.0|^7.0|^8.0
illuminate/database Version ^5.5|^6.0|^7.0|^8.0
illuminate/http Version ^5.5|^6.0|^7.0|^8.0
illuminate/support Version ^5.5|^6.0|^7.0|^8.0
symfony/http-kernel Version ^3.3|^4.0|^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package andrey-helldar/laravel-roles contains the following files

Loading the files please wait ....