/** * Show the form for editing the specified resource. * * @param int $id * * @return Response */ public function edit($id) { $user = User::findOrFail($id); $roles = Role::get(); $areas = Area::get(); return view('admin.users.edit', compact('user', 'roles', 'areas')); }
public function area() { return $this->belongsTo(Area::getClass()); }
/** * Remove the specified resource from storage. * * @param int $id * * @return Response */ public function destroy($id, Request $request) { $area = Area::findOrFail($id); $success = $area->delete(); if ($request->ajax()) { return response()->json(compact('success')); } Session::flash('danger', 'Se eliminó correctamente'); return redirect()->route('admin.areas.index'); }