src/Traits/MultiTenantable.php
/**
     * Boot the trait. Will apply any scopes currently set, and
     * register a listener for when new models are created.
     */
Boot the trait. Will apply any scopes currently set, and
register a listener for when new models are created.
Boot the trait . Will apply any scopes currently set and register a listener for when new models are created .
protected static function bootMultiTenantable()
    {
        static::$tm = app(TenantManager::class);
        static::$tm->addTenantScopes(new static());
        static::creating(function (Model $model) {
            static::$tm->newTenantModel($model);
        });
    }
protected static function bootMultiTenantable ( ) { static :: $ tm = app ( TenantManager :: class ) ; static :: $ tm -> addTenantScopes ( new static ( ) ) ; static :: creating ( function ( Model $ model ) { static :: $ tm -> newTenantModel ( $ model ) ; } ) ; }
Boot the trait.
Boot the trait .
// Add a global scope for each tenant this model should be scoped by. // Add tenant_columns automatically when creating models