/**
  * UnPublish cv
  *
  * @param  int  $id
  * @return redirect
  */
 public function postUnpublish()
 {
     $cv = CV::where('user_id', '=', Auth::user()->id)->first();
     $cv->published = false;
     $cv->save();
     return redirect('profile');
 }
 public function renderPDF($slug)
 {
     $cv = CV::where('slug', '=', $slug)->first();
     if ($cv && $cv->published) {
         return view('pdf')->with('cv', $cv);
     } else {
         return redirect('/');
     }
 }
 protected function initUser($user)
 {
     $default = Template::where('name', '=', 'default')->first()->id;
     $cv = CV::create(['user_id' => $user->id, 'template_id' => $default]);
     UserSeeder::seedCv($cv);
 }