public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         $status = Status::orderByRaw("RAND()")->first();
         $user = User::orderByRaw("RAND()")->first();
         Invoice::create(['due' => $faker->date(), 'status_id' => $status->id, 'amount' => $faker->randomFloat($nbMaxDecimals = 2), 'owner_id' => $user->id]);
     }
 }
Example #2
0
 public function getOwners()
 {
     $allOwners = User::all();
     $owners = [];
     foreach ($allOwners as $thisOwner) {
         if (empty($thisOwner->username)) {
             $thisOwner->username = $thisOwner->email;
         }
         $owners[$thisOwner->id] = $thisOwner->username;
     }
     return $owners;
 }
Example #3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }