framework icon indicating copy to clipboard operation
framework copied to clipboard

Child model events not triggering

Open maurocasas opened this issue 12 years ago • 3 comments

I think I've found a bug within model events.

When calling $modelA->modelB()->update(), the updating event within modelB is not triggered but modelA's is called.

maurocasas avatar Jun 30 '14 07:06 maurocasas

Can you post some real code?

taylorotwell avatar Jul 01 '14 02:07 taylorotwell

Of course! My bad.

$user->profile()->update(array( 'foo' => 'bar' ));

That code is actually triggering the Model Event updating in User Model, instead of Profile Model.

maurocasas avatar Jul 02 '14 04:07 maurocasas

Note: No model events are fired when updating a set of models via the Eloquent query builder.

bworwa avatar Aug 12 '14 14:08 bworwa