Hi,
I am coming from CodeIgniter Development and am fresh to Laravel. Unfortunately I have troubles getting the basics to run. For now I am working with Laravel 5, since my favorite CMS PyroCMS is going in that direction.
Now to my problem: My Laravel Installation is up & running in Homestead. But when I try to uncomment
require app_path('Http/routes.php');
in the RouteServiceProvider and create a routes.php in the Http Directory, entering routes as described, I am not able to access the url.
After that I tried to create a new Controller and added the annotation for a route, like this:
/**
* @Get("test")
*/
public function index()
{
return 'TestController';
}
That didn't work. Next I started artisan route:scan & route:list, the route was not in there.
When I try to install a route like that in the HomeController for a new function everything works fine.
Is the routing fundamentally broken right now, or what am I doing wrong here? Any help is greatly appreciated!
Can you post the contents of your routes.php file please.
Have you created the route to 'test' in there?
Found out a bot more about routing in laravel 5 (i havent upgraded yet so apologies for not reading your question further)
Does this article help?
http://mattstauffer.co/blog/laravel-5.0-route-annotations
Looks like adding your controller to the scan array is important?
I already read the article, but the current dev version doesn't work as described for me. Maybe there is a glitch currently. I think the RouteServiceProvider in app/Providers is not even loaded. When I try to change anything in that file it has no effect at all.
Sorry, as always it was my fault. The annotation way now works for me. My stupid editor (or was it me? :-) saved my TestController as an html file.
And after php a artisan clear-compiled call, the route.php Version does work as well.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community