I'm currently rebuilding an application and I currently have this in observer
public function updated(Lead $lead) {
if ( $lead->isDirty('status') && $lead->status === 'rejected') {
LeadRejected::dispatch($lead);
}
}
I'm removing the use of observer and want to dispatch the event directly from the model
something like;
protected $dispatchesEvents = [
'updated' => LeadUpdated::class,
];
I'd like to know if its possible to create a custom event key (model's lifecycle) I can hook the LeadRejected
event
something like
protected $dispatchesEvents = [
'rejected' => LeadRejected::class,
];