Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $schools = School::all();
     User::truncate();
     Role::truncate();
     factory(User::class, 50)->create()->each(function ($users) use($schools) {
         $users->schools()->attach(mt_rand(1, 5));
     });
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('admin.school.index')->withSchools(School::all());
 }