src/TenantManager.php.php
/**
     * Add tenant columns as needed to a new model instance before it is created.
     *
     * @param Model $model
     */
Add tenant columns as needed to a new model instance before it is created.
@param Model $model
Add tenant columns as needed to a new model instance before it is created . @param Model $model
public function newTenantModel(Model $model)
    {
        if ($this->tenants->isEmpty()) {
            $this->deferredModels->push($model);
            return;
        }
        $this->modelTenants($model)->each(function ($tenantId, $tenantColumn) use ($model) {
            if (!isset($model->{$tenantColumn})) {
                $model->setAttribute($tenantColumn, $tenantId);
            }
        });
    }
public function newTenantModel ( Model $ model ) { if ( $ this -> tenants -> isEmpty ( ) ) { $ this -> deferredModels -> push ( $ model ) ; return ; } $ this -> modelTenants ( $ model ) -> each ( function ( $ tenantId , $ tenantColumn ) use ( $ model ) { if ( ! isset ( $ model -> { $ tenantColumn } ) ) { $ model -> setAttribute ( $ tenantColumn , $ tenantId ) ; } } ) ; }
Add tenant columns as needed to a new model instance before it is created.
Add tenant columns as needed to a new model instance before it is created .
// No tenants yet, defer scoping to a later stage