haegemon/lara-find-event

Lara findEvent is a small library that enabled after find event for laravel model
74
Install
composer require haegemon/lara-find-event
License:GPL-2.0-or-later
Last Updated:Feb 12, 2018
Links: GitHub  ·  Packagist
Maintainer: haegemon

LaraFindEvent

Small library that enabled after find event at laravel

Installation

Require this package in your composer.json file:

"haegemon/lara-find-events": "dev-master"

...then run composer update to download the package to your vendor directory.

Usage

The feature is exposed through a trait that add new functionality to object. Event handler can be describe any standart way. For example we could create a Photos model like this:


use Eloquent\LaraFindEvents\LaraFindEvents as LaraFindEvents;

class Photo extends Eloquent
{
    use LaraFindEvents;
    
    public static function boot()
    {
        parent::boot();
    
        static::found(function (WildPlant $wildPlant) {
            var_dump('Iamfound', $wildPlant->id);
            return true;
        });
    }
}