示例#1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $toDeleteWork = Work::where('user_id', '=', Auth::user()->id)->where('id', '=', $id)->first();
     if ($toDeleteWork != null) {
         return response()->api($toDeleteWork->delete());
     }
     return response()->api(['NOT_FOUND']);
 }
示例#2
0
 public function generatePdf()
 {
     $personalInfo = PersonalInformation::where('user_id', '=', Auth::user()->id)->where('enabled', '=', 1)->first();
     $skills = SKill::with('skillType')->where('user_id', '=', Auth::user()->id)->where('enabled', '=', 1)->get();
     $work = Work::where('user_id', '=', Auth::user()->id)->where('enabled', '=', 1)->get();
     $education = Education::where('user_id', '=', Auth::user()->id)->where('enabled', '=', 1)->get();
     $photo = Photo::where('user_id', '=', Auth::user()->id)->where('enabled', '=', 1)->get();
     $data = ['personal' => $personalInfo->toArray(), 'skills' => $skills->toArray(), 'work' => $work->toArray(), 'education' => $education->toArray(), 'photo' => $photo->toArray()];
     // $headers = array(
     //     'Content-Type' => 'application/octet-stream',
     //     'Content-Length' => strlen($pdf),
     //     'Content-Dsiposition' => 'attachment; filename="resume.pdf"',
     //     'Authorization' => 'Bearer '.
     // )
     $pdf = PDF::loadView('resume', array('data' => $data));
     return $pdf->download('resume.pdf');
 }