/** * Show the form for creating a new Cruiseline. * * @return View */ public function create() { $rankings = Ranking::where('rankable_type', '=', 'App\\Brochure')->get(); $labels = Label::where('status', '=', '1')->where('type', '=', 'Brochure')->orderBy('name', 'ASC')->get(); foreach ($labels as $label) { $brochures[$label['name']] = Brochure::where('status', '=', '1')->where('label_id', '=', $label['id'])->orderBy('name', 'ASC')->lists('name', 'id'); } if (count($rankings)) { return view('brochurerankings.create', compact('brochures', 'rankings')); } return view('brochurerankings.create', compact('brochures')); }
/** * Show the form for creating a new Cruiseline. * * @return View */ public function edit($id) { $product = Product::find($id); $types = Type::where('status', '=', '1')->orderBy('name', 'ASC')->lists('name', 'id'); $categories = Category::where('status', '=', '1')->orderBy('name', 'ASC')->lists('name', 'id'); $brochures = Brochure::where('status', '=', '1')->whereHas('label', function ($q) { $q->where('name', '=', 'Size Charts'); })->orderBy('name', 'ASC')->lists('name', 'id'); $colours = Colour::where('status', '=', '1')->lists('name', 'id'); return view('products.edit', compact('product', 'types', 'categories', 'brochures', 'colours')); }
public function deactivate($id) { $brochure = Brochure::find($id); $brochure->status = 0; $brochure->save(); return redirect('home/brochures'); }
public function brochures() { $this->data['brochures'] = Brochure::where('status', '=', 1)->get(); $this->data['labels'] = Label::where('status', '=', 1)->where('type', '=', 'Brochure')->get(); $data = $this->data; return view('brochures', $data); }