Laravel default asset path includes the public folder but if your changed your root path and want to add prefix in your asset URL and want to change your asset path then this post will help you with various ways to change your asset path in your laravel application.
There are many ways to change asset paths and these ways I have discussed in this post how to use and change asset paths.
You can add prefix path or your modify to the directory with the same asset() function with a different URL or path.
Change From (.env)
Add below code in your .env file.
After adding this path in your .env file run the below command.
php artisan config:cache
This command will clear your config cache from the application.
Change In app.php
Goto in your app.php file below the given path and change your asset URL in this file given attribute name with asset_url.
'asset_url' => env('ASSET_URL', 'https://www.abc.com/public'),
Prefix Add-In Assets
We always thanks to you for reading our blogs.
Dharmesh Chauhan(Swapinfoway Founder)
We Are Also Recommending You :
- [Fixed] Binary Does Not Exist Laravel
- Laravel pwa Integration Tutorial
- How To Clone Laravel
- How to group routes based on sub-domain laravel?
- Default index.php Root Path Change And Remove Public From The Url
- Cashfree Payment Gateway Integration In Laravel
- Custom Validation Message Laravel
- Laravel Livewire CRUD Using Bootstrap Modal Full Example Guideline And Demo Source Code
- Web Push Notification Send Using Firebase Cloud Messaging In Laravel Tutorial Include Demo Example
- Everything know about Laravel Localization With Demo Example