Skip to content
This repository has been archived by the owner on Apr 27, 2019. It is now read-only.

EmilMoe/Guardian-Obsolete

Repository files navigation

Guardian

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Guardian is a framework for handling roles and permissions in Laravel. As SaaS and management web application are being more and more popular, it's essential to make the flow of the permissions as simple as possible, so you can focus on making the product.

Therefor I made this package which will enable you to define permissions in middleware. Not only does this allow you to separate the logic from your application it also allows you to perform php artisan route:list to see which part of your application is restricted by which permission.

Requirements

Guardian requires Laravel 5.1 in order to work due to it's use of middleware parameters. Other requirements are defined by Laravel 5.1.

Installation

The easiest way to install Guardian is to use composer. Run this composer in your shell to begin installation

composer require emilmoe/guardian

After the package has successfully been installed to your application, you must set up a service provider in config\app.php:

EmilMoe\Guardian\GuardianServiceProvider::class,

Publish the migrations and configuration files to your application by executing this command in your shell:

php artisan vendor:publish --provider="EmilMoe\GuardianServiceProvider"

Please take a look through the config fil in config\guardian.php as some configurations must be set before you migrate the package. The configurations is sefl explainable.

Last step is to migrate 4 tables to your database. Guardian currently only supports application with an database, the tables are used to keep track of roles, permissions and how they are related between and with your application.

Run the migration by executing this in your shell:

php artisan migrate

In your user model, which by default is App\User.php you must add this trait:

use WithPermission;

Read more about the traits in the trait section, but it's essential for Guardian to work.

Usage

See http://emilmoe.com/guardian/

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

Coming

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email emil@moegroup.dk instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Releases

No releases published

Packages

No packages published

Languages