Ларавел 5.7.У меня есть 2 модели: Foo
и Content
:
class Foo extends Model
{
public static function boot()
{
parent::boot();
static::updated(function() {
dd('here');
});
}
public function contents()
{
return $this->morphToMany('App\Content');
}
}
class Content extends Model
{
protected $touches = ['foos'];
public function foos()
{
return $this->morphedByMany('App\Foo');
}
}
Когда обновляется Content
, он правильно касается Foo
, обновляя свою отметку времени updated_at
.Но метод static::updated
не вызывается.Я ожидаю, что он будет вызван, так как Foo
был обновлен.