validate([ 'name' => 'required', 'description' => 'required', 'address' => 'required', ]); try { $validatedData = $request->except('_token'); m_warehouse::create($validatedData); return redirect()->back()->with('success', 'Data gudang berhasil ditambah.'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data gudang gagal ditambah.'); } return redirect()->back()->with('success', 'Data gudang berhasil ditambah.'); } /** * Display the specified resource. */ public function show($id) { // dd('oke'); } /** * Show the form for editing the specified resource. */ public function edit() { // dd('oke'); } /** * Update the specified resource in storage. */ public function update(Request $request, $id) { // dd('oke'); } /** * Remove the specified resource from storage. */ public function destroy($id) { // dd("oke"); try { $asset = m_warehouse::findOrFail($id); $asset->delete(); return redirect()->back()->with('success', 'Data Gudang berhasil dihapus'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data Gudang gagal dihapus'); } } }