The error that I am facing seems to be a common one. But the solutions I found on the various posts online, did not seem to solve my issue.
I am new to Laravel and have installed it on my local (WAMP) using a tutorial link.
The initial set-up seemed to work fine and my route (http://localhost/laravel/larashop/public/) page worked. However any other routes that I add to the routes.php or web.php file do not seem to work. I get an error saying NotFoundHttpException in RouteCollection.php line xyz.
My web.php file:
<?php
//works
Route::get('/', function () {
return view('welcome');
});
//does not work
Route::get('/hello',function(){
return "welcome";
});
//does not work
//Route::get('hello', 'Hello@index');
//does not work
/*Route::get('hello',function(){
return view('welcome');
});*/
I had used the php artisan make:controller Hello command to create the controller and added a simple index() function to it. But the links do not work even when I do not use the controller or the view (i.e. the return "welcome"
function).
I get the following to response to the php artisan route:list command:
c:\wamp64\www\Laravel\larashop>php artisan route:list
+--------+----------+----------+------+---------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+----------+------+---------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | GET|HEAD | hello | | Closure | web |
+--------+----------+----------+------+---------+--------------+
Any helps would be appreciated. I am stuck!
php artisan serve
for it ? - Demonyowh