Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Add Admin Users
     $admins = ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'];
     foreach ($admins as $admin) {
         Artisan::call('add:user', ['email' => $admin, '--role' => 'admin']);
     }
     // Add Contestant Users
     $waitingRooms = WaitingRoom::all();
     $totalRooms = count($waitingRooms);
     $seedContestants = $this->northstar->getAllUsers(['limit' => 100]);
     foreach ($seedContestants as $contestant) {
         $index = mt_rand(0, $totalRooms - 1);
         // Using first or create if someone is already an admin.
         $user = User::firstOrCreate(['id' => $contestant->id]);
         $user->waitingRooms()->save($waitingRooms[$index]);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $rooms = WaitingRoom::all();
     return view('waitingrooms.index', compact('rooms'));
 }