/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //DB::table('tbl_users')->delete();
     User::create(array('usr_firstName' => 'Daigo', 'usr_lastName' => 'Fernandez', 'username' => 'dfernandez', 'email' => '*****@*****.**', 'password' => bcrypt('@Daigo@10#')));
     User::create(array('usr_firstName' => 'Junior', 'usr_lastName' => 'Yauricasa', 'username' => 'jyauricasa', 'email' => '*****@*****.**', 'password' => bcrypt('@Junior@10#')));
     User::create(array('usr_firstName' => 'Galia', 'usr_lastName' => 'Camayo', 'username' => 'gcamayo', 'email' => '*****@*****.**', 'password' => bcrypt('@Galia@10#')));
     /*
     		DB::table('articles')->truncate();
       
               DB::table('articles')->insert([
                   [
                       'title'      => 'Laozi',
                       'body'       => 'When there is no desire, all things are at peace.',
                       'created_at' => '2015-01-31 23:59:59',
                       'updated_at' => '2015-01-31 23:59:59',
                   ],
                   [
                       'title'      => 'Leonardo da Vinci',
                       'body'       => 'Simplicity is the ultimate sophistication.',
                       'created_at' => '2015-02-01 00:00:00',
                       'updated_at' => '2015-02-01 00:00:00',
                   ],
                   [
                       'title'      => 'Cedric Bledsoe',
                       'body'       => 'Simplicity is the essence of happiness.',
                       'created_at' => '2015-02-01 00:00:01',
                       'updated_at' => '2015-02-01 00:00:01',
                   ],
               ]);
     */
 }
Exemplo n.º 2
0
 /**
  * Register the listeners for the subscriber.
  *
  * @param \Illuminate\Events\Dispatcher $events
  * @return void
  */
 public function subscribe($events)
 {
     User::observe('App\\Observers\\UserModelObserver');
     $events->listen('App\\Events\\User\\UserCreated', 'App\\Listeners\\UserEventListener@onUserCreated');
     $events->listen('App\\Events\\User\\UserUpdated', 'App\\Listeners\\UserEventListener@onUserUpdated');
     $events->listen('App\\Events\\User\\UserDeleted', 'App\\Listeners\\UserEventListener@onUserDeleted');
     $events->listen('App\\Events\\User\\UserRestored', 'App\\Listeners\\UserEventListener@onUserRestored');
     $events->listen('App\\Events\\User\\UserLoggedIn', 'App\\Listeners\\UserEventListener@onUserLogin');
     $events->listen('App\\Events\\User\\UserLoggedOut', 'App\\Listeners\\UserEventListener@onUserLogout');
 }
Exemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if ($this->command->confirm('Create admin account?')) {
         $name = $this->requiredValue('Name', 'Admin');
         $email = $this->requiredEmail('Email');
         $password = bcrypt($this->requiredValue('Password'));
         $user = User::create(compact('name', 'email', 'password'));
         $user->roles()->attach([UserRole::ADMIN, UserRole::MEMBER]);
     }
 }
Exemplo n.º 4
0
 /**
  * Sync a user's roles.
  *
  * @param User $user
  * @param int|array $roles
  * @return User
  */
 public function syncRoles(User $user, $roles)
 {
     $roles = is_array($roles) ? $roles : [$roles];
     $user->roles()->sync($roles);
     return $user;
 }
Exemplo n.º 5
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return \App\Data\Models\User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }