/** * Display the specified resource. * * @param $slug * @return \Illuminate\Http\Response */ public function show($slug) { $notes = Note::whereSlug($slug)->first(); if (is_null($notes)) { abort(404); } $file = storage_path('pdf/') . $notes->url; if (File::isFile($file)) { $file = File::get($file); $response = Response::make($file, 200); $response->header('Content-Type', 'application/pdf'); return $response; } return back()->withNotification('Error! Something Wrong')->withType('danger'); }