Last active
August 29, 2015 14:15
-
-
Save Adamwaheed/ca1fafc1324442e6451a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use App\user; | |
use App\GroupRresources; | |
use App\Resources; | |
class PermissionChecker { | |
public function handle($request, Closure $next) | |
{ | |
$user = User::with('group') | |
->where('id',1) | |
->first(); | |
$resources = Resources::where('action_name','=',$request->path())->first(); | |
$isAth = GroupRresources::where('user_group_id','=', $user->user_group_id) | |
->where('resources_id','=',$resources->id)->first(); | |
if (!$isAth) | |
{ | |
//return response('Unauthorized.', 401); | |
} | |
return $next($request); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment