I'm also very new to laravel, but wouldn't your url also have to include the id to match the route. What does http://localhost/newlaravel/public/cats/1 show you?
The slash before cats is missing in your example. Try this:
Route::get('/cats/{id}', function($id){ return "Cat #$id"; });
http://localhost/newlaravel/ -> incorrect because laravel uses /public dir as starting point
http://localhost/newlaravel/public // Shows you have arrived -> that is correct
http://localhost/newlaravel/public/cats //not work -> that is because you specified a parameter on your route. /cats/1 would be correct. Or anything really in this example.
This would return Cat #1, but if you specified /cats/something-else it would return Cat #something-else
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community