PHPackages                             acoustep/entrust-gui - 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. acoustep/entrust-gui

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

acoustep/entrust-gui
====================

A GUI for the Entrust package.

0.6.0(10y ago)11425.7k20[2 issues](https://github.com/acoustep/entrust-gui/issues)MITPHPPHP &gt;=5.5.0CI failing

Since Aug 12Pushed 4y ago7 watchersCompare

[ Source](https://github.com/acoustep/entrust-gui)[ Packagist](https://packagist.org/packages/acoustep/entrust-gui)[ Docs](https://github.com/acoustep/entrust-gui)[ RSS](/packages/acoustep-entrust-gui/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (13)Versions (13)Used By (0)

Entrust GUI
===========

[](#entrust-gui)

[![Code Climate](https://camo.githubusercontent.com/6b3a36832a7671bab19126e3d3898f26d9f2f9136c01e0dcce748dfa2ec7beab/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f61636f75737465702f656e74727573742d6775692f6261646765732f6770612e737667)](https://codeclimate.com/github/acoustep/entrust-gui)[![Build Status](https://camo.githubusercontent.com/ac24af5fc3c2a7a92a1ffd622f204ebefa51b3d9f7ef34760901584b8e0c7186/68747470733a2f2f7472617669732d63692e6f72672f61636f75737465702f656e74727573742d6775692e7376673f6272616e63683d74657374696e67)](https://travis-ci.org/acoustep/entrust-gui)[![Latest Stable Version](https://camo.githubusercontent.com/1782c8921edac42ef34d74bcfd87a65865387ba38efa689097c03eb3d19c5e93/68747470733a2f2f706f7365722e707567782e6f72672f61636f75737465702f656e74727573742d6775692f762f737461626c65)](https://packagist.org/packages/acoustep/entrust-gui)[![Total Downloads](https://camo.githubusercontent.com/9b8617ce9353f82a1f8e27c3550fc5d2f6fa865fbaca8f9227eee4b011cb8714/68747470733a2f2f706f7365722e707567782e6f72672f61636f75737465702f656e74727573742d6775692f646f776e6c6f616473)](https://packagist.org/packages/acoustep/entrust-gui)[![Latest Unstable Version](https://camo.githubusercontent.com/075e5bbc52e553238cc5552a7c2ad39c74db868e59e7040bcac5f923f9f7c77f/68747470733a2f2f706f7365722e707567782e6f72672f61636f75737465702f656e74727573742d6775692f762f756e737461626c65)](https://packagist.org/packages/acoustep/entrust-gui)[![License](https://camo.githubusercontent.com/313b728b9e37ba3e418f8be4da9c649a15bc3b70fb7d21a098134674598099f0/68747470733a2f2f706f7365722e707567782e6f72672f61636f75737465702f656e74727573742d6775692f6c6963656e7365)](https://packagist.org/packages/acoustep/entrust-gui)[![ko-fi](https://camo.githubusercontent.com/1fedf764fa06114b797ee53e7506df10880abed6766f854202d758df1707969d/68747470733a2f2f7777772e6b6f2d66692e636f6d2f696d672f676974687562627574746f6e5f736d2e737667)](https://ko-fi.com/P5P311GU6)

Entrust GUI is a Admin Interface that makes the administration of users, roles and permissions easier for the [Entrust](https://github.com/Zizaco/entrust) package.

This package is currently not for handling authentication, authorisation or registration of users.

[![User Panel Preview](https://camo.githubusercontent.com/3825e50b90a90471fdd0ada88b107ba6f7bdbbf9a21edf16b85f78a842f1fb10/687474703a2f2f692e696d6775722e636f6d2f39524a33714f692e706e67)](https://camo.githubusercontent.com/3825e50b90a90471fdd0ada88b107ba6f7bdbbf9a21edf16b85f78a842f1fb10/687474703a2f2f692e696d6775722e636f6d2f39524a33714f692e706e67)

Installation
------------

[](#installation)

*For Laravel 5.2 - 5.7 see the [5.2 branch](https://github.com/acoustep/entrust-gui/tree/5.2) for installation details.*

*For Laravel 5.8+ see the [5.8 branch](https://github.com/acoustep/entrust-gui/tree/5.8) for installation details.*

Add the package to your `composer.json` file

```
"acoustep/entrust-gui": "dev-master"

```

Add the service provider to your `config/app.php` file

```
Acoustep\EntrustGui\EntrustGuiServiceProvider::class,

```

Add the Entrust Alias to your `config/app.php` file as well.

```
'Entrust'   => Zizaco\Entrust\EntrustFacade::class,

```

Publish the configuration file(s)

```
php artisan vendor:publish --tag="config"

```

If you haven't already set up Entrust then make the migration file and run the migration.

```
php artisan entrust:migration
php artisan migrate

```

Entrust GUI uses [esensi/model](https://github.com/esensi/model) which means you can set your validation rules in your models.

To generate `User`, `Role` and `Permission` models run the `entrust-gui:models` command.

```
php artisan entrust-gui:models

```

See the **manually creating models** section if you prefer to adjust your current model files.

By default, all three files are published into the `app_path()` directory. You can specify the files separately and the location

Add the Entrust GUI middleware to `app\Http\Kernal.php`. This middleware will allow users with the role `admin` (case sensitive) to access Entrust GUI and deny other users.

```
protected $routeMiddleware = [
  // ...
  'entrust-gui.admin' => \Acoustep\EntrustGui\Http\Middleware\AdminAuth::class,
];

```

At this point you're all good to go. See Getting Started for how to use the package.

Getting Started
---------------

[](#getting-started)

### Accessing Entrust GUI

[](#accessing-entrust-gui)

By default all routes are prefixed with `/entrust-gui`.

- Users: `/entrust-gui/users`
- Roles: `/entrust-gui/roles`
- Permissions: `/entrust-gui/permissions`

You can change this prefix by editing `route-prefix` in `config/entrust-gui.php`.

```
'route-prefix' => 'admin'

```

Pointing your app to `/entrust-gui/users` will redirect you to `/auth/login` if you are not logged in as admin using the default `entrust-gui.admin` middleware.

If you have not set up Laravel authentication you will see a `NotFoundHttpException` exception. See the Laravel [Authentication](http://laravel.com/docs/5.1/authentication) documentation for setting up the Login system in Laravel 5.1.

### Middleware

[](#middleware)

By default Entrust GUI uses `entrust-gui.admin` for middleware. This allows logged in users with the `admin` role to access it.

You can change the middleware in `config/entrust-gui.php` in the `middleware` setting.

If you wish to test out the system without middleware then go to `config/entrust-gui.php` and set middleware to `null`.

```
'middleware' => null,

```

If you want to change the name of the role that has access to the `admin` middleware, update `middleware-role` in the configuration file.

```
"middleware-role" => 'sudo-admin',

```

### Layout

[](#layout)

To use your own layout override the `layout` key in `config/entrust-gui.php` with the template you wish to use.

```
"layout" => "app", // located in views/app.blade.php

```

Each template yields to `heading` and `content` so make sure your new layout has those sections.

```

  title

  @yield('heading')
  @include('entrust-gui::partials.notifications')
  @yield('content')

```

### Editing Templates

[](#editing-templates)

To edit the template files you first need to publish them

```
php artisan vendor:publish --tag="views"

```

All files are then stored in the `resources/views/vendor/entrust-gui` directory.

### Routes

[](#routes)

You may wish to link to pages in your own templates. EntrustGUI follows Laravel's `Route::resource` method with the exception of `show`.

```
route('entrust-gui::users.index')
route('entrust-gui::users.create')
route('entrust-gui::users.destroy', $id)
route('entrust-gui::users.update', $id)
route('entrust-gui::users.edit', $id)

```

### Events

[](#events)

The following event classes are available:

- `UserCreatedEvent`, `UserDeletedEvent`, `UserUpdatedEvent`.
- `RoleCreatedEvent`, `RoleDeletedEvent`, `RoleUpdatedEvent`.
- `PermissionCreatedEvent`, `PermissionDeletedEvent`, `PermissionUpdatedEvent`.

#### Example Event Listener

[](#example-event-listener)

```
