PHPackages                             smarch/watchtower - 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. smarch/watchtower

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

smarch/watchtower
=================

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

v1.1.5.4(9y ago)523.0k22[7 issues](https://github.com/SmarchSoftware/watchtower/issues)MITHTMLPHP &gt;=5.5.9

Since Dec 21Pushed 9y ago11 watchersCompare

[ Source](https://github.com/SmarchSoftware/watchtower)[ Packagist](https://packagist.org/packages/smarch/watchtower)[ Docs](https://github.com/SmarchSoftware/watchtower)[ RSS](/packages/smarch-watchtower/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (3)Versions (18)Used By (0)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Laravel 5.1](https://camo.githubusercontent.com/7d48a347cda33127449307a1ba24bdebf76d226c4f2a1585285c8e968f2666a9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e782d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](http://laravel.com)[![Packagist Version](https://camo.githubusercontent.com/61b1a740dfee7c32dc86ebd16d5102f6332b176b5497ec8a23f8d3f7fed04768/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d617263682f7761746368746f7765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smarch/watchtower)[![Total Downloads](https://camo.githubusercontent.com/f61279acf9389eee8f34712264538ca72b865b44d65327089aa46c6dd4096481/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d617263682f7761746368746f7765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smarch/watchtower)[![GitHub stars](https://camo.githubusercontent.com/6baabac714802ca2e64cf47507831d4c3cd9effaabfbbb1fb9427a5a66d2a92f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6261646765732f736869656c64732e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/SmarchSoftware/watchtower)

The Watchtower
==============

[](#the-watchtower)

### For Laravel 5.3 use the develop branch. Make sure you add the necessary Shinobi lines to your User model to get the permissions to work.

[](#for-laravel-53-use-the-develop-branch-make-sure-you-add-the-necessary-shinobi-lines-to-your-user-model-to-get-the-permissions-to-work)

A front end (GUI) package for the [Caffeinated/Shinobi](https://github.com/caffeinated/shinobi) RBAC authorization system for Laravel **5**.

[![enter image description here](https://camo.githubusercontent.com/0b0d53b95d503570ae08fe39d1acad332c8de6e952a5d3bba29e83045028dbbb/687474703a2f2f692e696d6775722e636f6d2f7a59426a5773462e706e67)](https://camo.githubusercontent.com/0b0d53b95d503570ae08fe39d1acad332c8de6e952a5d3bba29e83045028dbbb/687474703a2f2f692e696d6775722e636f6d2f7a59426a5773462e706e67)

This page is intended for installation, please check out the wiki for more information about usage.

- 📜 [Configuration Options](https://github.com/SmarchSoftware/watchtower/wiki/Configuration-Options)
- 🔑 [Permissions](https://github.com/SmarchSoftware/watchtower/wiki/Permissions)
- 👥 [Roles](https://github.com/SmarchSoftware/watchtower/wiki/Roles)
- 👤 [Users](https://github.com/SmarchSoftware/watchtower/wiki/Users)

Overview
--------

[](#overview)

This package is to administer / manage your roles and permissions tables with the Shinobi role based access control system for Laravel 5.

> ✋ **Note:**Shinobi is a required part of this package. This package is merely the GUI front end for the Shinobi package and this Watchtower package does not actually provide any of the authorization functionality. If you don't already have the Shinobi package installed, it will be installed as part of the installation of Watchtower.

It will give you full control over your roles 👥, their permissions 🔑 and the users 👤 that have access to them. You will be able to add, edit, update, delete and synchronize all three as needed.

Out of the box, Watchtower contains all the views necessary to enable Role &amp; Permissions management. It also provides the necessary permissions to secure your site so that only those allowed to perform the admin functions are permitted. Of course, this is made possible using Shinobi and, naturally, all views and permissions are configurable so you are free to provide your own views and change the permissions the way your app requires them.

---

##### Example of the user matrix

[](#example-of-the-user-matrix)

[![The User Matrix](https://camo.githubusercontent.com/b3f0620606d6464bbb60e23cab74d828ba6b7a603a79078bc13c8813bf83d822/687474703a2f2f692e696d6775722e636f6d2f6c5a4d783230422e706e67)](https://camo.githubusercontent.com/b3f0620606d6464bbb60e23cab74d828ba6b7a603a79078bc13c8813bf83d822/687474703a2f2f692e696d6775722e636f6d2f6c5a4d783230422e706e67)

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

[](#installation)

Depending on whether or not you have already installed Shinobi, your install is pretty straightforward. Install Watchtower, add Service Providers, add Facade, run DB commands. Win.

> ✋ ***Note***Even though Watchtower uses a few packages to properly theme and layout the admin area, they are referenced through [cdnjs.com](https://cdnjs.com/) and are **not installed locally**.
>
> *Watchtower makes use of the following packages : [Bootstrap](http://getbootstrap.com), [Bootstrap theming](http://bootswatch.com), [JQuery](http://jquery.com), [Pace](http://github.hubspot.com/pace/docs/welcome/), [Sweetalert](http://t4t5.github.io/sweetalert/) and [Modernizr](https://modernizr.com/). If you wish to not use the cdn versions and use local versions instead, modify the master.layout file to reflect those changes. (Or alternately, use the config file to point your master.layout to your local copies of those packages.)*

#### 🔲 Composer

[](#black_square_button-composer)

##### *For Laravel 5.0 - 5.2 you can simply run this line at the command prompt.*

[](#for-laravel-50---52-you-can-simply-run-this-line-at-the-command-prompt)

```
 composer require "smarch/watchtower"

```

##### *For Laravel 5.3 put the following line in your composer.json file.*

[](#for-laravel-53-put-the-following-line-in-your-composerjson-file)

```
"smarch/watchtower": "@dev"

```

#### 📝 Service Provider

[](#pencil-service-provider)

Once composer has installed the necessary packages for watchtower to function you need to open your laravel config page for service providers and add Watchtower. To properly function you need to have all 3 service providers referenced : Shinobi, [HTML Forms](https://laravelcollective.com/docs/5.1/html) and Watchtower.

*config/app.php*

```
       /*
        * Third Party Service Providers
        */
        Caffeinated\Shinobi\ShinobiServiceProvider::class, // For RBAC
        Collective\Html\HtmlServiceProvider::class, // For Watchtower Forms to function
        Smarch\Watchtower\WatchtowerServiceProvider::class, // For Watchtower
```

#### 📝 Facades

[](#pencil-facades)

While Watchtower itself does not need a facade, one is provided if you wish to use one. However the Shinobi and Forms facades are used heavily by Watchtower so be sure you add them to your Facades.

*config/app.php*

```
        /*
        * Third Party Service Providers
        */
        'Form'     => Collective\Html\FormFacade::class,  // required for Watchtower Forms
        'HTML'     => Collective\Html\HtmlFacade::class,   // required for Watchtower Forms
        'Shinobi'  => Caffeinated\Shinobi\Facades\Shinobi::class, // For RBAC functions
        //'Watchtower'=> Smarch\Watchtower\WatchtowerFacade::class, // not required, but available
```

#### 📇 Database Migrations / Seeds

[](#card_index-database-migrations--seeds)

If you did not install Shinobi earlier, you will need to run the migration files to properly set up and create the necessary tables. From your command prompt (wherever you run your artisan commands) enter the following command php artisan vendor:publish and then php artisan migrate. This should properly create your necessary tables AND create the Watchtower config file *(which allows you to define any views / permissions you wish to change from their defaults)*.

```
    php artisan vendor:publish
    php artisan migrate
```

> ✋ ***Note*** If you already have your roles and permissions set up, you can skip the following step and just change the Watchtower config file to reflect the permissions it should use to permit functionality.

To permit the ability to restrict and permit access to the various admin areas of Watchtower, you will need to run the Watchtower seeder which will prepopulate your database with permissions and roles.

```
php artisan db:seed --class Smarch\Watchtower\Seeds\WatchtowerTableSeeder

```

#### 📝 Shinobi usage requirements

[](#memo-shinobi-usage-requirements)

If you are installing Shinobi now, with Watchtower, you will need to also make the following changes so that you can use Shinobi's RBAC functions instead of Laravel defaulting to its own "Gate" authorization methods. Modify your User model to reflect the following changes *(stripping out Laravel's Authorizable contracts and traits)* :

```
