samedi 10 août 2019

Override boot function when insert function calling in Laravel

I have override boot function inside the laravel model, code structure something like this:

class modelName extends Model
{
        protected static function boot(){
        parent::boot();
        self::creating(function ($model){
        //Do Some Stuff
        });
}

This is working fine when I'm calling create a function, like this:

modelName::create($tmpArray);

But it's not working when I want to use insert function:

modelName::insert($tmpArray);

Now I want to call boot function when insert function called.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire