5 months ago

Model event with multiple parameters

Posted 5 months ago by akogler

Hi to all,

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!

Please sign in or create an account to participate in this conversation.