HipsterJazzbo\Landlord\BelongsToTenants::bootBelongsToTenants PHP Method

bootBelongsToTenants() public static method

Boot the trait. Will apply any scopes currently set, and register a listener for when new models are created.
public static bootBelongsToTenants ( )
    public static function bootBelongsToTenants()
    {
        // Grab our singleton from the container
        static::$landlord = app(TenantManager::class);
        // Add a global scope for each tenant this model should be scoped by.
        static::$landlord->applyTenantScopes(new static());
        // Add tenantColumns automatically when creating models
        static::creating(function (Model $model) {
            static::$landlord->newModel($model);
        });
    }