Add Public to asset path in Laravel Add Public to asset path in Laravel laravel laravel

Add Public to asset path in Laravel


Add ASSET_URL=public in your .env file and run php artisan config:cache


For the latest version of Laravel - Laravel 5.8, there is a key in config/app.php with name asset_url. The value of this key determines the value that the asset() method returns. Normally, you should set the value of this key to the base url of your website if all your asset folders are in the default location (this default location is the public folder under the root directory of your Laravel installation).

For example if your website url is "https://www.example.com" and you want to access the asset path public/assets/css/sample.css under the root folder, set the asset_url in config/app.php like this:

'asset_url' => env('ASSET_URL', 'https://www.example.com'),