/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(User $user) { if ($user) { $president = HumanResource::president(); $positions = Position::all(); $departments = Department::department()->get(); $institutes = Department::institute()->get(); return view('user.api.edit')->with(compact('user', 'president', 'positions', 'departments', 'institutes')); } else { return false; } }
/** * Display a listing of the resource. * * @return Response */ public function index() { $departments = Department::department()->get(); $institutes = Department::institute()->get(); $positions = Position::all(); return view('employee.index')->with(compact('departments', 'institutes', 'positions')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $position = Position::create($request->all()); return response()->json($position, 201); }
public function show($id) { $position = Position::findOrFail($id); return response()->view('positions.show', compact('position')); }