Esempio n. 1
0
 public function onConvertFromPerms()
 {
     $manager = PluginManager::instance();
     if ($manager->exists('shahiemseymor.roles')) {
         $perms = DB::table('shahiemseymor_permissions')->get();
         foreach ($perms as $perm) {
             $newRows[] = ['id' => $perm->id, 'name' => $perm->name, 'description' => $perm->display_name];
         }
         Key::insert($newRows);
     }
 }
Esempio n. 2
0
 public function keys()
 {
     if (!count($this->keys)) {
         if (!Auth::getUser()) {
             return [1];
         }
         $this->keys = Key::whereHas('groups.users', function ($q) {
             $q->where('user_id', Auth::getUser()->id);
         })->lists('name', 'id');
     }
     return $this->keys;
 }
Esempio n. 3
0
 public static function passage_keys()
 {
     if (!count(self::$keys)) {
         if (!Auth::getUser()) {
             return [];
         }
         self::$keys = Key::whereHas('groups.users', function ($q) {
             $q->where('user_id', Auth::getUser()->id);
         })->lists('name', 'id');
     }
     return self::$keys;
 }