Exemple #1
0
 private static function session()
 {
     session_start();
     if (!isset($_SESSION['frame_key'])) {
         $_SESSION['frame_key'] = \Frame\Key::get();
         return null;
     }
     return \Work\Models\User::with('group.role.controller')->where('session', '=', $_SESSION['frame_key'])->first();
 }
Exemple #2
0
 public static function hasRole($roll)
 {
     $user = \Work\Models\User::with('group.role')->where('session', '=', $_SESSION['frame_key'])->first();
     if (isset($user->group)) {
         foreach ($user->group as $group) {
             if (isset($group->pivot->role)) {
                 foreach ($group->pivot->role as $role) {
                     if ($role->pivot->role == $roll) {
                         return true;
                     }
                 }
             }
         }
     }
     return false;
 }