/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(saveTeacherRequest $request)
 {
     $request->merge(array('remaining_credit' => $request->input('assigned_credit')));
     // Set remaining credit equal to assigned credit
     $teacher = new Teacher($request->except(['department', 'designation']));
     $department = Department::where('name', $request->input('department'))->first();
     $designation = Designation::where('name', $request->input('designation'))->first();
     $teacher->department()->associate($department);
     $teacher->designation()->associate($designation);
     $teacher->save();
     $teacher_request = new UserRequestHandle('Teacher', $request->input('email'));
     $teacher_request->save();
     $request->session()->flash('status', 'Teacher was saved successful!');
     return back();
 }
 /**
  * Remove a designation from storage.
  *
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroyDesignation($id)
 {
     Designation::where('id', $id)->delete();
     Session::flash('success_message', 'Designation has been deleted from database');
     return redirect('config');
 }