/** * Update the specified resource in storage. * * @param ServiceRequest $request * @param int $id * @return \Illuminate\Http\Response */ public function update(ServiceRequest $request, $id) { $input = $request->all(); $input['type'] = 'Service'; Item::find($id)->update($input); return redirect()->route('product.index')->withMessage('Service has been Updated')->withStatus('success'); }
/** * Update the specified resource in storage. * * @param Services $services * @param ServiceRequest $request * @return \Illuminate\Http\RedirectResponse */ public function update(Services $services, ServiceRequest $request) { $oldImage = null; if ($request->file('upl')) { $oldImage = Attachment::where('id', $services->attachment_id); $imageModel = ImageUploadFacade::attachmentUpload($request->file('upl'), new Attachment(), 'services'); $services->attachment_id = $imageModel->id; } $services->update($request->input()); if ($oldImage) { $oldImage->delete(); } return redirect()->route('admin.services.index'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(ServiceRequest $request) { Service::create($request->all()); return redirect('services'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(ServiceRequest $request, $id) { $service = Service::findOrfail($id); $service->fill($request->all()); $service->save(); return redirect(route('services.' . $service->section))->with('message', 'Servicio actualizado corectamente'); }