/** * 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]); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return view('admin.productLines.index', ['productLines' => ProductLine::all()]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $reviewTagList = ReviewTag::lists('text', 'text'); return View('admin.reviews.edit', ['productList' => Product::all()->lists('title', 'id'), 'productLineList' => ProductLine::all()->lists('title', 'id'), 'regionTechnologyList' => RegionTechnology::all()->lists('username', 'id'), 'reviewTagList' => $reviewTagList, 'productReview' => Review::find($id)]); }