Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $adminRole = new Role();
     $adminRole->name = 'admin';
     $adminRole->display_name = 'Admin';
     $adminRole->description = 'Admin for backend';
     $adminRole->is_admin = 1;
     $adminRole->save();
     $userRole = new Role();
     $userRole->name = 'user';
     $userRole->display_name = 'User';
     $userRole->description = 'user for backend';
     $userRole->is_admin = 0;
     $userRole->save();
     $admin = User::where('email', '*****@*****.**')->first();
     $assRoleAdmin = new AssignedRole();
     $assRoleAdmin->user_id = $admin->id;
     $assRoleAdmin->role_id = $adminRole->id;
     $assRoleAdmin->save();
     $user = User::where('email', '*****@*****.**')->first();
     $assRoleUser = new AssignedRole();
     $assRoleUser->user_id = $user->id;
     $assRoleUser->role_id = $userRole->id;
     $assRoleAdmin->save();
 }
Ejemplo n.º 2
0
 protected function create($values)
 {
     $data = [];
     foreach ($this->structure as $i => $key) {
         $data[$key] = $values[$i];
     }
     AssignedRole::create($data);
 }