/**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($slug, TrainerFormRequest $request)
 {
     $trainer = Trainer::whereSlug($slug)->firstOrFail();
     $trainer->name = $request->get('name');
     $trainer->email = $request->get('email');
     $trainer->country = $request->get('country');
     $trainer->skill_set = $request->get('skill_set');
     $trainer->gender = $request->get('gender');
     $trainer->educational_qualification = $request->get('educational_qualification');
     $trainer->previous_experience = $request->get('previous_experience');
     $trainer->date_of_birth = $request->get('date_of_birth');
     $trainer->cell_number = $request->get('cell_number');
     if ($request->get('status') != null) {
         $trainer->status = 0;
     } else {
         $trainer->status = 1;
     }
     $trainer->save();
     return redirect(action('TrainersController@edit', $trainer->slug))->with('status', 'The trainer status has been updated!');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update($slug, TrainerFormRequest $request)
 {
     $input = $request->all();
     if (isset($input['image'])) {
         $Image = $input['image'];
         //dd($Image);
         $imagePath = $this->imageUpload($Image);
         //call public function imageUpload for small img
     } else {
         $imagePath = Trainer::where('slug', '=', $slug)->pluck('filePath');
         //dd($imagePath);
     }
     $trainer = Trainer::whereSlug($slug)->firstOrFail();
     $trainer->name = $request->get('name');
     $trainer->email = $request->get('email');
     $trainer->country = $request->get('country');
     $trainer->skill_set = $request->get('skill_set');
     $trainer->gender = $request->get('gender');
     $trainer->educational_qualification = $request->get('educational_qualification');
     $trainer->previous_experience = $request->get('previous_experience');
     $trainer->date_of_birth = $request->get('date_of_birth');
     $trainer->cell_number = $request->get('cell_number');
     $trainer->filePath = $imagePath;
     if ($request->get('status') != null) {
         $trainer->status = 0;
     } else {
         $trainer->status = 1;
     }
     $trainer->save();
     return redirect(action('TrainersController@show', $trainer->slug))->with('status', 'The trainer status has been updated!');
 }