Last change
on this file since a55bb54 was 7304c7f, checked in by beratkjufliju <kufliju@…>, 3 years ago |
added user authentication, create & forgot password methods and blades
|
-
Property mode
set to
100644
|
File size:
471 bytes
|
Rev | Line | |
---|
[7304c7f] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Middleware;
|
---|
| 4 |
|
---|
| 5 | use Closure;
|
---|
| 6 |
|
---|
| 7 | class CheckPermission
|
---|
| 8 | {
|
---|
| 9 | /**
|
---|
| 10 | * Handle an incoming request.
|
---|
| 11 | *
|
---|
| 12 | * @param \Illuminate\Http\Request $request
|
---|
| 13 | * @param \Closure $next
|
---|
| 14 | * @return mixed
|
---|
| 15 | */
|
---|
| 16 | public function handle($request, Closure $next, $permission)
|
---|
| 17 | {
|
---|
| 18 | $user = auth()->user();
|
---|
| 19 |
|
---|
| 20 | if($user->hasPermission($permission)) {
|
---|
| 21 | return $next($request);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | return abort(403);
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.