Brand::query()->paginate(10) ]); } /** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { return view('bo.pages.brands.create'); } /** * Store a newly created resource in storage. * * @param StoreBrandRequest $request * @return \Illuminate\Http\Response */ public function store(StoreBrandRequest $request) { $newBrand = new Brand(); $newBrand->fill($request->validated()); $newBrand->saveOrFail(); return redirect()->route('bo.brands.index') ->with(['success' => 'La marque ' . $newBrand->name . ' a bien été créée.']); } /** * Show the form for editing the specified resource. * * @param Brand $brand * @return \Illuminate\Http\Response */ public function edit(Brand $brand) { return view('bo.pages.brands.edit', [ 'brand' => $brand ]); } /** * Update the specified resource in storage. * * @param UpdateBrandRequest $request * @param Brand $brand * @return \Illuminate\Http\Response */ public function update(UpdateBrandRequest $request, Brand $brand) { $brand->fill($request->validated()); $brand->saveOrFail(); return redirect()->route('bo.brands.index') ->with(['success' => 'La marque ' . $brand->name . ' a bien été modifiée.']); } /** * Remove the specified resource from storage. * * @param Brand $brand * @return \Illuminate\Http\Response */ public function destroy(Brand $brand) { $brand->deleteOrFail(); return redirect()->route('bo.brands.index') ->with(['warning' => 'La marque ' . $brand->name . ' a bien été supprimée.']); } }