/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $deleteChecked = Input::get('list');
     if ($deleteChecked) {
         foreach ($deleteChecked as $delete) {
             $resumdel1 = Qualification::where('id', $delete)->delete();
         }
         Session::flash('message', 'Successfully deleted');
     } else {
     }
     return Redirect::to('qualification');
 }
 public function updateQualification(Request $request)
 {
     //dd($request->all());
     $teacher = $request->user->deriveable;
     if ($request->has('language')) {
         $teacher->languages()->sync($request->input('language'));
     }
     if ($request->has('qualification')) {
         foreach ($request->input('qualification') as $key => $qualification) {
             $qualification['verification'] = $request->files->all()['qualification'][$key]['verification'];
             $qualification['passout'] = Carbon::createFromFormat('d/m/Y', $qualification['passout'])->toDateTimeString();
             if (array_key_exists('verification', $qualification) && $qualification['verification'] !== NULL) {
                 $file = $qualification['verification'];
                 $destinationPath = 'img/uploads';
                 $filename = str_random(12);
                 $extension = $file->getClientOriginalExtension();
                 $upload_status = $file->move($destinationPath, $filename . "." . $extension);
                 if ($upload_status) {
                     $qualification['verification'] = $destinationPath . "/" . $filename . "." . $extension;
                 }
             }
             if (array_key_exists('id', $qualification)) {
                 $id = $qualification['id'];
                 unset($qualification['id']);
                 Qualification::where('id', $id)->update($qualification);
             } else {
                 $qual = new Qualification();
                 $qual->teacher_id = $request->user()->id;
                 $qual->college = $qualification['college'];
                 $qual->degree = $qualification['degree'];
                 $qual->branch = $qualification['branch'];
                 $qual->passout = $qualification['passout'];
                 $qual->verification = $qualification['verification'];
                 $qual->save();
             }
         }
     }
     //dd($request->all());
     $teacher->update($request->only(['experience', 'home_tuition']));
     flash('Your information has been updated.');
     return redirect('/profile/' . $request->user->id . '/update/qualification');
 }