public function applyTenantScopes(Model $model)
{
if (!$this->enabled) {
return;
}
$this->modelTenants($model)->each(function ($id, $tenant) use($model) {
$model->addGlobalScope($tenant, function (Builder $builder) use($tenant, $id, $model) {
$builder->where($model->getTable() . '.' . $tenant, '=', $id);
});
});
}