Laravel Fireable Attributes

Laravel Fireable Attributes

Laravel Fireable is a package by Boris Lepikhin that provides “an elegant way to trigger Laravel events based on attributes changes.”

Here’s an example from the project’s documentation that shows how this package works. In this example, updating a user’s status attribute triggers a UserApproved event:

class User extends Authenticatable
{
    use FireableAttributes;

    protected $fireableAttributes = [
        'status' => [
            'approved' => UserApproved::class,
            'rejected' => UserRejected::class,
        ],
    ];
}

In some cases, you want to trigger an event whenever an attribute is changed regardless of its value:

class User extends Authenticatable
{
    use FireableAttributes;

    protected $fireableAttributes = [
        'email' => EmailUpdated::class,
    ];
}

To learn more about this package, get full installation instructions, and view the source code on GitHub at envant/fireable.


Filed in: News / packages


Newsletter

Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior Laravel Developer (Full-Stack)
Munich
Volunteer Vision GmbH
Full-Stack Developer
Tampa
Nu Image Medical
Senior Software Developer
Remote (US ONLY)/Kenilworth, NJ
Diversified
Senior Back-end Laravel API Developer - Immediate Contract (Full Time)
Remote
ApproveMe // Document Signing
Web Development Project Manager
Houston, TX
Swyft Filings
Experienced Laravel/VueJS Developer (Freelance)
Remote (preferably in the US)
Prosperly LLC
Senior React / Laravel Developer
Remote
The C.A.S.E. Engineering Group