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); } }
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; }
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; }