validate([ 'fullname' => 'required', 'nip' => 'required', 'email' => 'required', 'no_hp' => 'required', 'divisi' => 'required', 'address' => 'required', 'status' => 'required', 'role_id' => 'required', 'warehouse_id' => 'required', ]); // dd($request->all()); try { $user = User::findOrFail($id); $user->update($request->all()); return redirect()->route('user.index')->with('success', 'Data User berhasil diperbaharui'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data User gagal diperbaharui'); } } /** * Remove the specified resource from storage. */ public function destroy($id) { // dd("oke"); try { $user = User::findOrFail($id); $user->delete(); return redirect()->back()->with('success', 'Data user berhasil dihapus'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data user gagal dihapus'); } } }