/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(EditUserRequest $request, $id) { $user = User::findOrFail($id); $user->fill($request->all()); $user->save(); return redirect()->back(); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, Request $request) { abort(500); $user = User::findOrFail($id); //$user->delete(); $message = 'Se elimino al usuario ' . $user->full_name; if ($request->ajax()) { return response()->json(['id' => $user->id, 'message' => $message]); } Session::flash('message_type', 'alert-success'); Session::flash('message', $message); return "Usuario eliminado"; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { dd(User::findOrFail($id)); }
public function findUser(Route $route) { $this->user = User::findOrFail($route->getParameter('users')); }
/** * Remove the specified resource from storage. * * @param int $id * @param Request $request * @return Response */ public function destroy($id, Request $request) { abort(500); $user = User::findOrFail($id); $user->delete(); $message = $user->full_name . ' fue eliminado de nuestros registros'; if ($request->ajax()) { /*return $message;*/ return response()->json(['id' => $user->id, 'message' => $message]); } Session::flash('message', $message); return redirect()->route('admin.users.index'); }