Auth Component extends the functionality of Illuminate\Auth
with the extra functionality to retrieve users' role. This is important when we want to use Orchestra\Acl to manage application Access Control List (ACL).
Laravel | Auth |
---|---|
4.0.x | 2.0.x |
4.1.x | 2.1.x |
4.2.x | 2.2.x |
5.0.x | 3.0.x |
To install through composer, simply put the following in your composer.json
file:
{
"require": {
"orchestra/auth": "~3.0"
}
}
And then run composer install
from the terminal.
Above installation can also be simplify by using the following command:
composer require "orchestra/auth=~3.0"
Next replace Illuminate\Auth\AuthServiceProvider
with the following service provider in config/app.php
.
'providers' => [
// ...
'Orchestra\Auth\AuthServiceProvider',
'Orchestra\Authorization\AuthorizationServiceProvider',
'Orchestra\Memory\MemoryServiceProvider',
'Orchestra\Auth\CommandServiceProvider',
'Orchestra\Memory\CommandServiceProvider',
],
CommandServiceProvider
are optional, useful for interaction using the Artisan command line tool.
To make development easier, you could add Orchestra\Support\Facades\ACL
alias for easier reference:
'aliases' => [
'ACL' => 'Orchestra\Support\Facades\ACL',
],