コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(Priola\ProductCategory::class, 5)->create()->each(function ($pc) {
         for ($i = 0; $i < 1; $i++) {
             if (rand(0, 1) == 1) {
                 $pc->productLines()->save(factory(Priola\ProductLine::class)->make());
             }
         }
     });
     foreach (\Priola\ProductCategory::all() as $productCategory) {
         factory(Priola\Product::class, 10)->create(['product_category_id' => $productCategory->id])->each(function ($p) {
             for ($i = 0; $i < 5; $i++) {
                 $p->productColors()->save(factory(Priola\ProductColor::class)->make());
             }
             $p->masterClasses()->save(factory(Priola\MasterClass::class)->make());
         });
     }
     foreach (\Priola\ProductLine::all() as $productLine) {
         factory(Priola\Product::class, 10)->create(['product_line_id' => $productLine->id])->each(function ($p) {
             for ($i = 0; $i < 5; $i++) {
                 $p->productColors()->save(factory(Priola\ProductColor::class)->make());
             }
             $p->masterClasses()->save(factory(Priola\MasterClass::class)->make());
         });
     }
     foreach (\Priola\MasterClass::all() as $masterClass) {
         factory(Priola\MasterClassStep::class, 6)->create(['master_class_id' => $masterClass->id]);
     }
 }
コード例 #2
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return view('admin.masterClasses.index', ['masterClasses' => MasterClass::all()]);
 }
コード例 #3
0
 public function masterClasses()
 {
     return view('home.masterClasses.index', ['masterClasses' => MasterClass::all()]);
 }