/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(BrandRequest $request, $id) { $brand = Brand::findOrFail($id); $brand->update($request->all()); flash('Brand has been updated'); return Redirect::back(); }
public function update(Request $request, $id) { $brand = Brand::findOrFail($id); $data = $request->all(); if ($request->hasFile('image')) { $image_name = $request->input('name') . Carbon::now()->timestamp . "_" . $request->file('image')->getClientOriginalName(); $request->file('image')->move(public_path() . '/images/brands/', $image_name); $data = $request->all(); $data['image'] = $image_name; } $brand->update($data); return redirect(url('brands')); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { $this->validate($request, ['nama_brand' => 'required|max:200', 'image' => 'mimes:jpeg,bmp,png']); $brand = Brand::findOrFail($id); //$data = $request->only('name', 'model'); $data['nama_brand'] = $request->nama_brand; if ($request->hasFile('image')) { $data['logo_brand'] = $this->savePhoto($request->file('image')); } if ($brand->update($data)) { \Flash::success('Brand Berhasil Diupdate'); } else { \Flash::info('Brand Gagal Diupdate'); } return redirect('admin/brand'); }
public function destroy($id) { $brand = Brand::findOrFail($id); $brand->delete(); return \Response::json(['error' => false, 'code' => 200, 'feedback' => 'Brand has been deleted.'], 200); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { $this->brands->findOrFail($id)->delete(); return \Redirect::route('admin.brands.index')->withMessage(trans('brand.brands-controller-successfully_deleted')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $brand = Brand::findOrFail($id); $brand->delete(); $brand->category()->detach(); return redirect()->route('admin.brand.index')->with('alert-success', 'Delete complete'); }
public function showBrand($id) { // show brand info $brand = Brand::findOrFail($id); return View::make('admin/merck/brands/show', compact('brand')); }
public function create($id) { $this->layout = null; $brand = Brand::findOrFail($id, ['id', 'name']); return view('product.create', compact('brand')); }