Best laravel framework open-source packages.

Laravel_spatie_permissao

Laravel 5.6 - User Roles and Permissions (ACL) using Spatie Tutorial
Updated 5 years ago

Laravel 5.6 Installation

Laravel 5.6 - User Roles and Permissions (ACL) using Spatie Tutorial

Spatie Package Installation

Now we require to install Spatie package for ACL, that way we can use it's method. So Open your terminal and run bellow command.

$ composer require spatie/laravel-permission

config/app.php

'providers' => [

....

Spatie\Permission\PermissionServiceProvider::class,

],

Adicionar

Add given bellow text to your composer.json file.

"require": {
"laravel/framework": "5.0.*",
"laravelcollective/html": "~5.0"
},

OR

$ composer require laravelcollective/html

after fire composer update command After Update composer, open config/app.php and add this line to the ‘providers’ array:

'Collective\Html\HtmlServiceProvider', Next, add these lines to the ‘aliases’ array:

'FORM' => 'Collective\Html\FormFacade', 'HTML' => 'Collective\Html\HtmlFacade',

Try this.........

We can also custom changes on Spatie package, so if you also want to changes then you can fire bellow command and get config file in config/permission.php.

$ php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"

$ php artisan migrate

Create Table using Migrations

In this step we have to create three migrations for as listed bellow tables:

  1. users

  2. products

  3. roles

  4. permissions

  5. model_has_permissions

  6. model_has_roles

  7. role_has_permissions

So, if you install fresh project then you have already users table migration but if you don't have products table, so can create manually and other table can create using Spatie package command, so run bellow command and check migration file also.

$ php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"

$ php artisan make:migrate create_products_table

Aconselho ha usar estes comandos tambem.

$ composer require laravel/passport
$ php artisan migrate
$ php artisan passport:install

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as:

Laravel is accessible, yet powerful, providing tools needed for large, robust applications.

License

Taylor Otwell via taylor@laravel.com. The Laravel framework is open-sourced software licensed under the MIT license.