예제 #1
0
 public function runMaster()
 {
     $this->command->comment("\tInserting system roles.");
     foreach ($this->slugs() as $slug) {
         $role = Role::where(['role' => $slug['role'], 'board_uri' => $slug['board_uri'], 'caste' => $slug['caste'], 'system' => true])->first();
         if (!$role || !$role->exists || $role->role_id != $slug['role_id']) {
             if ($role) {
                 $role->forceDelete();
                 Role::forceDelete($slug['role_id']);
             }
             $role = new Role($slug);
             $role->role_id = $slug['role_id'];
             $role->save();
         }
     }
 }