User Groups and Rights, Fewo
This commit is contained in:
parent
c0c2a1822c
commit
26ecb09cdc
22 changed files with 1316 additions and 787 deletions
26
app/Http/Middleware/AuthPermission.php
Executable file
26
app/Http/Middleware/AuthPermission.php
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Auth;
|
||||
|
||||
class AuthPermission
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $key)
|
||||
{
|
||||
if ( Auth::check() && Auth::user()->isPermission($key) )
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
return redirect('/home');
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue