/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::reguard();
     $modules = Module::all()->pluck('id');
     \DB::table('available_modules')->truncate();
     foreach ($modules as $id) {
         AvailableModule::create(['profile_type' => 'Administrator', 'module_id' => $id]);
     }
 }
Esempio n. 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::reguard();
     $data['data'] = ['name' => 'Administrator'];
     $availableModules = AvailableModule::where('profile_type', '=', 'Administrator')->pluck('module_id');
     $data['permissions'] = Permission::whereIn('module_id', $availableModules)->get();
     if ($role = $this->repository->find(1)) {
         $this->repository->update($role, $data);
     } else {
         $this->repository->create($data);
     }
 }