I need to send an email right after an artisan command is execute to get confirmed whether its executed correctly or not. What i'am thinking right now is send it inside the handle function
in the command class as,
public function handle()
{
// command logic
//send an email
Mail::send('....
}
I found that this is so embarassing because there are lot of command registered in the app.
My question is about: Is there any global place that i can handle this case, both success and failed(due to an Exception)?
P.S. I saw that there is a method called reportException
in ConsoleKernel
class so i think i can override that function in Kernel
class to send the mail when there is a failure, correct me if i'am wrong.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire