Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Boot method laravel life cycle

class User extends Model 
{

    public static function boot()
    {
        parent::boot();

        self::creating(function($model){
            // ... code here
        });

        self::created(function($model){
            // ... code here
        });

        self::updating(function($model){
            // ... code here
        });

        self::updated(function($model){
            // ... code here
        });

        self::deleting(function($model){
            // ... code here
        });

        self::deleted(function($model){
            // ... code here
        });
    }

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Boot #method #laravel #life #cycle
ADD COMMENT
Topic
Name
8+1 =