validated()); $service->obtaineds()->sync($request->input('obtaineds')); return redirect()->route('admin.service.index')->with('message', "Service Successfully Created !"); } /** * Display the specified resource. * * @param \App\Models\Service $service * @return \Illuminate\Http\Response */ public function show(Service $service) { return redirect()->route('admin.service.index'); } /** * Show the form for editing the specified resource. * * @param \App\Models\Service $service * @return \Illuminate\Http\Response */ public function edit(Service $service) { $obtaineds = Obtained::pluck('name', 'id'); $serviceCategories = ServiceCategory::get(); return view('admin.services.edit', compact('service', 'obtaineds', 'serviceCategories')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\Service $service * @return \Illuminate\Http\Response */ public function update(UpdateServiceRequest $request, Service $service) { $service->update($request->validated()); $service->obtaineds()->sync($request->input('obtaineds')); return redirect()->route('admin.service.index')->with('message', "Service Successfully Updated !"); } /** * Remove the specified resource from storage. * * @param \App\Models\Service $service * @return \Illuminate\Http\Response */ public function destroy(Service $service) { $service->delete(); return redirect()->route('admin.service.index')->with('message', "Service Successfully Deleted !"); } }