2015年1月28日星期三

Matt Stauffer: Laravel 5.0 - Generating Missing Events


In the next part of his series introducing the upcoming version of the Laravel framework Matt Stauffer has posted part 16, about generating missing events.



Sometimes it can seem like a lot of work to create an event, create its handler, and bind the two. Create a command, create its handler, bind the two. I've often wished for a workflow that handled the whole process together in one. The artisan commands for generating commands and events are a good start--they both create their own entity and (optionally) its handler. But you still can spend an hour writing the command and handler, and then waste another 15 minutes trying to figure out why it's not working, only to realize you never actually bound the two together.


The solution to this in Laravel 5 is the "event:generate" handling with the artisan command line tool. He includes a look at the event handlers directories and files before executing the command and what changes post-execution, including the sample code generated for the event.


Link: http://mattstauffer.co/blog/laravel-5.0-generating-missing-events

没有评论:

发表评论