Exemple #1
0
 /**
  * 
  * @param String $tag Tag name 
  * @param String $role Role name
  * @param String $action Action name
  */
 public function getAction($tag, $role, $action)
 {
     if ($tag === null || $role === null || $action === null) {
         Log::debug('permissionExists: Tag, Role, Action cannot be null');
         return null;
     }
     try {
         $t = Tag::where('name', '=', $tag)->firstOrFail();
         $r = Role::where('tag_id', '=', $t->id)->where('name', '=', $role)->firstOrFail();
         $a = Action::where('role_id', '=', $r->id)->where('name', '=', $action)->firstOrFail();
         Log::debug('Knock Permission Found: Tag=' . $tag . ', Role=' . $role . ', Action=' . $action);
         return $a;
     } catch (ModelNotFoundException $e) {
         Log::debug('Knock Caught Exception: ' . $e->getMessage());
         return null;
     }
 }