Is there a way to hook into an artisan command easily? What I'm looking to accomplish is have a piece of code executed everytime the php artisan migrate command is executed.
Just add a listener some place in your code (even at the top of app/start/artisan.php) to listen for the 'artisan.start' event.
Event::listen('artisan.start', function($app)
{
// $app is instance of Illuminate\Console\Application
// since the $app hasn't figured the command yet you'll
// have to do it yourself to check if it's the migrate command
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With