for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
/**
* Class Authorisation.
*/
class Authorisation
{
* The Guard implementation.
*
* @var Guard
protected $auth;
* Create a new filter instance.
* @param Guard $auth
public function __construct(Guard $auth)
$this->auth = $auth;
}
* Handle an incoming request.
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
public function handle(\Illuminate\Http\Request $request, Closure $next)
if (Auth::user()->cannot('isSuperAdmin', Auth::user())) {
return Redirect::to('auth/login')->with('danger', "Vous n'etes pas authoriser a acéder à cette partie :(");
return $next($request);