public function run()
 {
     factory('Foobooks\\User', 50)->create();
     $user = \Foobooks\User::firstOrCreate(['email' => '*****@*****.**']);
     $user->name = 'Jill';
     $user->email = '*****@*****.**';
     $user->password = \Hash::make('helloworld');
     $user->save();
     $user = \Foobooks\User::firstOrCreate(['email' => '*****@*****.**']);
     $user->name = 'Jamal';
     $user->email = '*****@*****.**';
     $user->password = \Hash::make('helloworld');
     $user->save();
 }
Beispiel #2
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'])]);
 }
 function getExample12()
 {
     #get the current logged in user
     $user = \Auth::user();
     if ($user) {
         echo 'Hi logged in user ' . $user->name . '<br>';
     }
     #get a user from the database
     $user = \Foobooks\User::where('name', 'like', 'Jamal')->first();
     echo 'Hi ' . $user->name . '<br>';
 }