Download the PHP package foothing/laravel-lock-routes without Composer
On this page you can find all versions of the php package foothing/laravel-lock-routes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download foothing/laravel-lock-routes
More information about foothing/laravel-lock-routes
Files in foothing/laravel-lock-routes
Package laravel-lock-routes
Short Description Add route-based checks for Laravel Lock permissions.
License MIT
Informations about the package laravel-lock-routes
Laravel Lock Routes
This is a Laravel 5 package that allows to bind Lock
permissions
to routes.
It implements a Lock
provider for Laravel Wrappr.
Install
Setup
Add the Wrappr
service provider in yourconfig/app.php
providers array.
Publish package configuration and migration files
Update your config/wrappr.php
Middlewares
There are two middleware use cases. You can use within Laravel Router or with complex pattern routes. More info in the Wrappr documentation.
Enable Laravel Router Middleware
Use the CheckRoute Middleware to control access to your routes like the following routes.php:
The CheckRoute
Middleware accepts 3 arguments:
- the required permission
- an optional resource name, i.e. 'user'
- an optional resource identifier (integer)
Example:
Also, the Middleware can handle your route arguments. Consider the following
When you pass a resource identifier within the brackets, the middleware will try to retrieve the value from the http request automatically.
Enable custom routes Middleware
When you're not able to fine-control at routes definition level, there's an alternative way of handling permissions. Think about a global RESTful controller like the following:
Assume that your controller applies a variable pattern to handle the routes, like for example
In this case you won't be able to bind permissions with the previous method, so
the CheckPath
middleware comes to help. In order to enable this behaviour you need
some additional setup step.
Add the global Middleware to your App\Http\Kernel
like this
Now you can configure your routes in the config file or programmatically following the Wrappr routes documentation.
ACL abstraction layer
If you want more decoupling from your app and the acl library (Lock in this case) you can use the acl manipulation methods that are implemented in the provider. See example:
License
All versions of laravel-lock-routes with dependencies
illuminate/auth Version ~5.0
illuminate/database Version ~5.0
beatswitch/lock-laravel Version 0.5.*
foothing/laravel-wrappr Version ~0.5