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 :
- Laravel Tap Payment Gateway Integration Tutorial Example
- Laravel 9 Seeder and How to Seeding
- Laravel Pagination Not Working While Using Map Method [solved]
- Laravel OneSignal Push Notification Integrate
- Arr::accessible() | Laravel Helper Function
- collapse() Method | Laravel Collection Example
- Single Session User Login in Laravel
- Arr::crossJoin() | Laravel Helper Function
- Laravel 10 Forum Integration Tutorial Example
- How to Generate PDF File Using DomPDF In Laravel 9 Example