У меня есть модель ProductPrice, в которой я регистрирую атрибут наблюдателя с помощью ObservedBy следующим образом:
Код: Выделить всё
#[ObservedBy([ProductPriceObserver::class])]
class ProductPrice extends Model
{
use HasFactory, HasUlids;
protected $fillable = ['price', 'is_current', 'product_id'];
}
manually registering the observer in the boot method of EventServiceProvider works
Код: Выделить всё
public function boot(): void
{
ProductPrice::observe(ProductPriceObserver::class);
}
reference here
Источник: https://stackoverflow.com/questions/781 ... ot-working
Мобильная версия