jeremykenedy /
laravel-roles
| 1 | <?php |
||
| 2 | |||
| 3 | namespace jeremykenedy\LaravelRoles\Traits; |
||
| 4 | |||
| 5 | trait RolesUsageAuthTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Variable to hold if we are using built in Laravel authentication. |
||
| 9 | */ |
||
| 10 | private $_rolesGuiAuthEnabled; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Variable to hold if we are using roles/permissoins middleware for access. |
||
| 14 | */ |
||
| 15 | private $_rolesGuiMiddlewareEnabled; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Variable to hold what roles/permissions middleware we are using if enabled. |
||
| 19 | */ |
||
| 20 | private $_rolesGuiMiddleware; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Create a new controller instance. |
||
| 24 | * |
||
| 25 | * @return void |
||
| 26 | */ |
||
| 27 | public function __construct() |
||
| 28 | { |
||
| 29 | $this->_rolesGuiAuthEnabled = config('roles.rolesGuiAuthEnabled'); |
||
| 30 | $this->_rolesGuiMiddlewareEnabled = config('roles.rolesGuiMiddlewareEnabled'); |
||
| 31 | $this->_rolesGuiMiddleware = config('roles.rolesGuiMiddleware'); |
||
| 32 | |||
| 33 | if ($this->_rolesGuiAuthEnabled) { |
||
| 34 | $this->middleware('auth'); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 35 | } |
||
| 36 | |||
| 37 | if ($this->_rolesGuiMiddlewareEnabled) { |
||
| 38 | $this->middleware($this->_rolesGuiMiddleware); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 |