I'm working on a laravel project and inside the project i store .pdf
files to my local phpmyadmin and retrieve it back to display in the browser.
I see some applications but they're saving the .pdf
files locally while uploading it to DB. And then it becomes so easy to display with <img src="">
but i don't want to use this.
These are my routes;
Route::get('/users/{user}/posts', 'PostController@index');
Route::get('/posts/create', 'PostController@create');
Route::post('/posts', 'PostController@store');
And index function;
public function index(User $user, Post $posts)
{
$posts = DB::table('posts')
->where('userId', '=', $user->id)
->get();
return view('post.index', compact('posts'));
}
I can upload and store .pdf
files that OK but cannot display in the browser.
So I want to get the record with index function in PostController(which is done already) and display the .pdf
file in index.blade.php file which comes from db.
like this: http://localhost/test.pdf
When i display it in the browser i can see only it's name. How can i read the file that i get it from db
?
Thank you for your answers.