The issue you're encountering is due to the incorrect URL path being generated for the file stored in the storage/app/public directory. In Laravel, files stored in the storage/app/public directory should be accessed via the public/storage URL, not directly from storage/app/public.
To resolve this, you need to ensure that the symbolic link between storage/app/public and public/storage is correctly set up. You can create this symbolic link by running the following Artisan command:
php artisan storage:link
This command will create a symbolic link from public/storage to storage/app/public, allowing you to access your files via the correct URL.
Next, you should update your Blade template to use the correct path. The Storage::url method will generate the correct URL for files stored in the public disk. Ensure that your file is stored in the public disk and that you are using the correct path.
Here's how you can update your Blade template:
<embed src="{{ Storage::url($invoice->file) }}" width="100" height="150" alt="pdf"/>
Make sure that $invoice->file contains the correct relative path to the file within the public disk, for example, sample.pdf.
If your file is stored in storage/app/public/sample.pdf, the correct path to store in the database and use in your Blade template would be sample.pdf.
So, your final Blade template should look like this:
<embed src="{{ Storage::url('sample.pdf') }}" width="100" height="150" alt="pdf"/>
After making these changes, your PDF should be correctly embedded and displayed in the browser.