PHPackages                             pierresilva/laravel-sentinel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. pierresilva/laravel-sentinel

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

pierresilva/laravel-sentinel
============================

Laravel 5 Roles and Permissions

5.3(9y ago)21411MITPHPPHP &gt;=5.6.4

Since Feb 11Pushed 9y ago1 watchersCompare

[ Source](https://github.com/pierresilva/laravel-sentinel)[ Packagist](https://packagist.org/packages/pierresilva/laravel-sentinel)[ RSS](/packages/pierresilva-laravel-sentinel/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

Sentinel
========

[](#sentinel)

Sentinel brings a simple and light-weight role-based permissions system to Laravel's built in Auth system.

Sentinel brings support for the following ACL structure:

- Every user can have zero or more roles.
- Every role can have zero or more permissions.

Permissions are then inherited to the user through the user's assigned roles.

Quick Installation
------------------

[](#quick-installation)

Begin by installing the package through Composer. The best way to do this is through your terminal via Composer itself:

```
composer require pierresilva/laravel-sentinel

```

Once this operation is complete, simply add the service provider to your project's `config/app.php` file and run the provided migrations against your database.

### Service Provider

[](#service-provider)

```
pierresilva\Sentinel\SentinelServiceProvider::class,
```

### Facade

[](#facade)

```
'Sentinel' => pierresilva\Sentinel\Facades\Sentinel::class,
```

Then open the Kernel.php file in app\\Http\\Kernel.php and add this to user it as middleware :

### routeMiddleware

[](#routemiddleware)

```
 'roles' => \pierresilva\Sentinel\Middleware\UserHasRole::class,
 'permissions' => \pierresilva\Sentinel\Middleware\UserHasPermission::class,
```

### Migrations

[](#migrations)

You'll need to run the provided migrations against your database. Publish the migration files using the `vendor:publish` Artisan command and run `migrate`:

```
php artisan vendor:publish

```

```
php artisan migrate

```

Usage
-----

[](#usage)

Sentinel package comes bundled with a SentinelTrait file to be used within your User's Model file. This trait file provides all the necessary functions to tie your users in with roles and permissions.

### Example User Model

[](#example-user-model)

```
