If your public directory is not the document root of your server, this will happen. There are a few choices.
Run php artisan serve
with your command line interface. From there, you can access your development site most likely on http://localhost:8000, and everything will render correctly.
Or, you can load all your assets (css, images, scripts, etc.) using the asset helper method. So instead of /css/app.css
, you can do asset('css/app.css')
and it will render out the full path. In other words, it will render out 'http://localhost/larapack/public/css/app.css'.
For your routes, instead of using the asset()
helper, you can use other helper methods like route()
. This accepts your route name. So, lets say you have something like this in your routes.php file...
Route::get('auth/login', ['as' => 'login', 'uses' => 'Auth\AuthController@getLogin']);
'login' would be the path name so route('login')
would render out the full path to your login url, which would be http://localhost/larapack/public/auth/login
Thank you for answer thomastkim asset helper worked like charm it was not working earlier I forgot to include curly braces I was not familiar with those helper.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community