Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

[SOLVED] Error: Access CSS/js file in Local and Laravel-development Server both.

In Laravel, our all assets are in the public directory, But it gives error while we run Same code in Laravel development server and Local Server. See below how

If we are running a Laravel development server then to access the CSS/JS file we need to write only css/layout.css. But if we run the similar code in Local server it shows error.
and, when we are running a Local server, we need to write public/css/layout.css to access the CSS/JS file. But if we run a similar code in Laravel development server it shows error.

So, what should we do to run the code on both Servers?

We write the below code to Access our CSS/JS file:-

{{asset(‘_Our-CSS/JS-file-path_’)}}

See the Below image of my code:-

After adding the above code you are able to run your code in both the Servers ( Laravel development server and Local Server ).