/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // Find the user skill $skill = Education::where('user_id', '=', Auth::user()->id)->where('id', '=', $id)->first(); if ($skill != null) { return response()->api($skill->delete()); } }
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'); }