Commit 22820a2c authored by Nicolas Widart's avatar Nicolas Widart

Adding a base filter class

parent 13864c74
<?php namespace Modules\Core\Http\Filters;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Laracasts\Flash\Flash;
class PermissionFilter
{
public function filter($route, $request)
{
$action = $route->getActionName();
$actionMethod = substr($action, strpos($action, "@") + 1);
if (Sentinel::hasAccess("{$request->segment(2)}.$actionMethod"))
{
return;
}
Flash::error('Permission denied.');
return Redirect::to('/' . Config::get('core::core.admin-prefix'));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment