/**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $user = User::create(['username' => 'admin', 'email' => '*****@*****.**', 'password' => 'admin']);
     // add admin role
     $adminRole = Role::where('name', 'admin')->first();
     $user->attachRole($adminRole);
 }
Exemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Roles
     $admin = new Role();
     $admin->name = 'admin';
     $admin->display_name = 'Admin';
     $admin->description = 'Administration users';
     $admin->save();
     $user = new Role();
     $user->name = 'user';
     $user->display_name = 'User';
     $user->description = 'Registered users';
     $user->save();
     // Permissions
     $permission_user = new Permission();
     $permission_user->name = 'user-administration';
     $permission_user->display_name = 'User: Administration';
     $permission_user->description = 'CRUD users';
     $permission_user->save();
     $permission_video = new Permission();
     $permission_video->name = 'video-administration';
     $permission_video->display_name = 'Video: Administration';
     $permission_video->description = 'CRUD video';
     $permission_video->save();
     $admin->attachPermissions([$permission_user, $permission_video]);
     // User
     $admin_user = User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => 'admin']);
     $admin_user->attachRole($admin);
 }
Exemplo n.º 3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 protected function create(array $data)
 {
     $redirect = request('redirect');
     if (!empty($redirect)) {
         $this->redirectTo = $redirect;
     }
     Flash::success(trans('user::user.registered_successful'));
     return User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'email_token' => str_random(18)]);
 }
Exemplo n.º 4
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param array $data
  *
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['username' => $data['username'], 'email' => $data['email'], 'password' => $data['password']]);
 }