/**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $permissions = [];
     foreach (Route::getRoutes() as $key => $route) {
         if (!is_null($route->getName())) {
             $permissions[$route->getName()] = 1;
         }
     }
     try {
         User::create(['name' => $this->argument('name'), 'email' => $this->argument('email'), 'password' => bcrypt($this->argument('password')), 'permissions' => $permissions]);
         $this->info('User created successfully.');
     } catch (QueryException $e) {
         $this->error('User already exists!');
     }
 }
Example #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param User $user
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy(User $user)
 {
     $user->delete();
 }
Example #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'], 'password' => bcrypt($data['password'])]);
 }