mercredi 8 mai 2019

Laravel model event with multiple parameter

I have currently implemented an event that gets fired when a model get created:

protected $dispatchesEvents = [
    'created' => EvaluationRequestForZ0UQ0::class
];

Nothing special, it works fine. But I would like to invoke the event on model creation with multiple parameters. Something like that:

protected $dispatchesEvents = [
    'created' => event(new EvaluationRequestForZ0UQ0(User $param1, Job $param2))
];

How could I achieve that? Maybe my approach is wrong. If so, feel free to tell me another approach.

Many thanks in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire