Beispiel #1
0
 /**
  * @param array $options
  * @return bool
  */
 public function save(array $options = array())
 {
     $this->attributes['full_name'] = $this->attributes['first_name'] . ' ' . $this->attributes['last_name'];
     if (!array_key_exists('avatar', $this->attributes)) {
         $this->attributes['avatar'] = 'uploads/avatars/default.png';
     }
     return parent::save($options);
 }
Beispiel #2
0
 private function _users()
 {
     $provinces = Province::all();
     foreach ($provinces as $p) {
         $faker = \Faker\Factory::create();
         $user = new User();
         $user->name = $faker->name;
         $user->province_id = $p->id;
         $user->email = $faker->email;
         $user->password = Hash::make('123456');
         $user->save();
         $license = License::where('used', 0)->first();
         $license->used = 1;
         $license->save();
         $license->user()->attach($user);
         $score = new Score();
         $score->score = rand(100, 3500);
         $score->license = $license->license;
         $score->save();
     }
 }