O'Reilly logo

Mastering Laravel by Christopher John Pecoraro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using annotations in Laravel 5

Let us recall the pathway that was implemented in Laravel, as illustrated here:

  • The HTTP request gets routed to a controller
  • The command is instantiated inside of the controller
  • An event is fired
  • The event is handled
Using annotations in Laravel 5

Laravel's modern command-based pub-sub pathway.

Using annotations, this process can be rendered even easier. First, a reservations controller will be created:

$ php artisan make:controller ReservationsController

To create a route to allow the user to create a new reservation, the POST HTTP verb will be used. The @Post annotation will listen to requests with the POST method attached to the /bookRoom url. This is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required