示例#1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $garbleUser = User::where('name', 'gable')->get()->first();
     //New Install or being seeder being run for another time.
     if (empty($garbleUser) && empty(User::first())) {
         $userInfo = ['name' => 'Garble Admin', 'username' => 'garble', 'password' => Hash::make(env('APP_KEY'))];
         /** @var User $user */
         $user = factory(User::class)->create($userInfo)->save();
         //            $user->assignRole('admin');
     }
 }
示例#2
0
 public function before(User $user)
 {
     if ($user->isAdmin()) {
         return true;
     }
 }
示例#3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'username' => $data['username'], 'password' => bcrypt($data['password'])]);
 }