chelout/laravel-relationship-events
Adds the missing relationship events to Laravel Eloquent models. Traits for hasOne, belongsTo, hasMany, belongsToMany, morphOne, morphTo, morphMany, morphToMany, and morphedByMany let you listen for saved, updated, attached, detached, and other events, useful for cache invalidation and audit logs.
illuminate/* ^13.0 and PHP ^8.3.#[\Override] attributes and native return types across relation classes and event traits for full PHP 8.3+ type safety.prefer-lowest and prefer-stable), exercising the real consumer install path instead of dev snapshots.morphToMany toggle events and argument-less detach().| Package | Laravel | PHP |
|---|---|---|
v5.x |
13.x |
^8.3 |
v4.x |
12.x |
^8.2 |
v3.x |
11.x |
^8.2 |
v2.x |
10.x |
^8.1 |
Full Changelog: https://github.com/chelout/laravel-relationship-events/compare/v4.0.0...v5.0.0
Added PHP 8 support. Thanks @nhedger !
Fixed #34
Nothing new, just moved to github actions.
Finished documentation.
It is possible to fire event classes via $dispatchesEvents properties:
use Chelout\RelationshipEvents\Relationships\Concerns\HasOneEvents;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use HasOneEvents;
protected $dispatchesEvents = [
'hasOneSaved' => HasOneSaved::class,
];
}
How can I help you explore Laravel packages today?