Laravel 5.5 image storage asset() helper config - laravel

I have images in storage/app/ trying to access them with {{asset('about.jpg')}}. The path that is returned == test.com/about.jpg but the image resides in test.com/storage/about.jpg. Should I change the {{asset('storage/about.jpg')}} or is there a filesystem issue I am not seeing? TY

As per laravel doc try linking your directory by using php artisan storage:link
and then you can access your file like {{asset('about.jpg')}}

Related

Assets are not linking in my laravel project

after running php artisan serve my project is running on http://127.0.0.1:8000/.
I am inserting files on logo folder my inserting code is
$request->file('logo')->store('logo', 'public');
this code is inserting files inside \storage\app\public\logo\
Now when I try to view this file in image there is no image showing
my image view code is
http://127.0.0.1:8000/storage/logo/eoFICKlGoU8yDoJrLGYfKFsx6Yq4uGvDs5yC9WQ7.png
my filesystem default is 'default' => env('FILESYSTEM_DISK', 'public'),
also in the env it FILESYSTEM_DISK = public
I have tried
php artisan config:clear
php artisan storage:link
php artisan optimize:clear
But still failed to show the image in . Please help I have tried many method available on stackoverflow
Simply run, php artisan storage:link.
The problem might be that your storage is not linked to your public folder.

How to display images from storage path using artisan serve

I was using laravel by the project URL without using serve and i didn't have this kind of problems.
But now i'm using it, so i thought that this is the reason.
I've got a problem to display the images from storage path, i tried some stuff like run the storage link PHP artisan storage:link and get the path using storage_path('app/' . $filename) but it didn't work
Your are not providing correct path to the storage_path helper your storage_path('app/' . $filename) is not working because you have not put / before app try putting a slash before app like storage_path('/app/' . $filename)
also
if you want to get the file in blade then you can use url helper like {{ url('storage/app/'.$filename) }}

Asset Helper Function Not Working Correctly in Laravel 5.7

I'm new to MVC and Laravel, and I'm trying to include CSS but getting a 404 error. The URL it's generating is...
http://localhost/testing_laravel/css/app.css
If I use the URL this way instead...
http://localhost/testing_laravel/public/css/app.css
It works fine.
My question is why do the tutorials and documentation not use '/public'? Is there something I am not aware of? Please guide me on how I should use URLs for assets.
{{ asset('css/app.css') }}
The asset() helper prepends the base URL (http://localhost/testing_laravel) to the given path 'css/app.css'. Within the Laravel directory structure, these assets live in the /public folder and Laravel knows that.
When you create your virtual host for your Laravel install you need to make the /public directory the root. Or, try php artisan serve.
You are missing the port http://localhost:8000/testing_laravel/css/app.css
Just open command line & point to root of your project, Then run php artisan serve.
This is the proper way.
{{ asset('css/app.css') }} will point to the public directory

Laravel pdf issue: failed to open stream: No such file or directory by using barryvdh/laravel-dompdf package

I am update composer and use barryvdh/laravel-dompdf package.
the problem is when i click the button it show me error like image below:-
Is that anyway to change the folder path? or am I missing code to modify path to download the pdf file?
You need to run this command:
php artisan vendor:publish
Then, try to create a fonts directory in the storage directory.
i.e. storage/app/fonts. Also, remember to make it writable.
For maximum execution time of 30 seconds exceeded, this is not laravel related issue but it's about php configuration issue. Please see this and fix it: http://php.net/manual/en/info.configuration.php#ini.max-execution-time
You can also see this answer: https://stackoverflow.com/a/30290770/6000629
Hope this will helps you!
Try this:
$pdf = PDF::loadView('pdf/personalpdf', compact('user','result'))->setOptions(['defaultFont' => 'sans-serif']);
It worked for me, I didn't make any file/folder
Just remove the reference to css external file in your cart.placeOrder.blade
Note: This directory must exist and be writable by the webserver process.
under the config file thats what it say: therefore you should create the fonts directory inside the storage.
"font_cache" => storage_path('fonts/'),

Laravel 4 (4.2.8) Generate model in app folder and not model

When I run this command
php artisan generate:model Post
it generates the Post.php at app/Post.php and not in model. What I am doing wrong?
You can force the path by adding path option
Try this
php artisan generate:model Post --path=app/models
The reason it is placing new file in app directory is because you must have edited the path in your config file.
See more about configurations

Resources