Tag Archives: annotations

Laravel 5.0 – route annotation

This is are my discovers on the new routing system on Laravel 5.0.

Yah! I was trying, yesterday to use this new thing on Laravel.
Theres a huge discussion about in on Laracasts (https://laracasts.com/discuss/channels/general-discussion/route-annotation-in-laravel-5) … I’m not concerned about it… I just want it to work… how/why have they chosen this way its *their* problem.

Ok! yesterday I got a little mad with it.
I was following the book! and I wasn’t getting it to work.

This is how it works.

We need to add our controllers to app/Providers/RouteServiceProvider.php.

RouteServiceProvider Laravel 5.0

Add your new controller to the list.

On our controller

 /**
 * @Get("/tos/")
 */
 public function terms()
 {
     echo '<h1>Terms of Service!</h1>';
 }

 

After adding all your route annotations, you will need to update the “route:list” or what they call…

This is how…

php artisan clear-compiled
php artisan route:scan

and list them on console…

php artisan route:list

Your routes should work now.

 

 

 More readings

http://mattstauffer.co/blog/laravel-5.0-route-annotations
https://laracasts.com/discuss/channels/general-discussion/route-annotation-in-laravel-5
http://www.reddit.com/r/laravel/comments/2jex9b/introducing_route_annotations_in_laravel_50/