adamthehutt / eloquent-constructed-event
This package is abandoned and no longer maintained.
No replacement package was suggested.
Eloquent model trait to add a 'constructed' event, which will fire immediately after object construction
Package info
github.com/adamthehutt/eloquent-constructed-event
pkg:composer/adamthehutt/eloquent-constructed-event
v1.3.0
2020-09-24 02:49 UTC
Requires
- illuminate/database: ^5.8 | ^6.0 | ^7.0 | ^8.0
- illuminate/support: ^5.8 | ^6.0 | ^7.0 | ^8.0
Requires (Dev)
- orchestra/testbench: ^3.8 | ^4.0
- phpunit/phpunit: ^8.2
This package is auto-updated.
Last update: 2022-01-10 20:30:27 UTC
README
Eloquent model trait to add a 'constructed' event, which will fire immediately after object construction
Install
composer require adamthehutt/eloquent-constructed-event
Use
Add the trait to an Eloquent model:
class MyModel extends Model { use AdamTheHutt\EloquentConstructedEvent\HasConstructedEvent; }
Do interesting things after model construction:
public static function boot() { static::registerModelEvent("constructed", function (MyModel $model) { $model->generateUuid(); $model->tellTheWorldIExist(); }); }