/** * @update Function Update department * @param Department $department (get department that will update from provider route model binding $router->model) * @param validationRequest $request paramter send from edit form * @redirct to department index with term_id **/ public function update(Department $department, validationRequest $request) { $department->spec_id = $request->input('spec_id'); $department->parent_id = $request->input('parent_id'); $department->subject_ids = json_encode($request->input('subject_ids')); $department->save(); $term_id = $request->input('term_id'); return redirect()->route('as.departments.index', [$term_id])->with('success', trans('academystructure::departments.update_success')); }