Skip to content

Commit

Permalink
Apply fixes from StyleCI (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caleb Fidecaro committed Jan 7, 2018
1 parent c606829 commit 593a4fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Exceptions/ModelNotFoundForTenantException.php
Expand Up @@ -7,7 +7,7 @@
class ModelNotFoundForTenantException extends ModelNotFoundException implements TenantExceptionInterface
{
/**
* @param string $model
* @param string $model
* @param int|array $ids
*
* @return $this
Expand Down
8 changes: 5 additions & 3 deletions src/TenantManager.php
Expand Up @@ -61,7 +61,7 @@ public function disable()
* Add a tenant to scope by.
*
* @param string|Model $tenant
* @param mixed|null $id
* @param mixed|null $id
*
* @throws TenantNullIdException
*/
Expand Down Expand Up @@ -140,12 +140,13 @@ public function applyTenantScopes(Model $model)
if ($this->tenants->isEmpty()) {
// No tenants yet, defer scoping to a later stage
$this->deferredModels->push($model);

return;
}

$this->modelTenants($model)->each(function ($id, $tenant) use ($model) {
$model->addGlobalScope($tenant, function (Builder $builder) use ($tenant, $id, $model) {
if($this->getTenants()->first() && $this->getTenants()->first() != $id){
if ($this->getTenants()->first() && $this->getTenants()->first() != $id) {
$id = $this->getTenants()->first();
}

Expand All @@ -167,7 +168,7 @@ public function applyTenantScopesToDeferredModels()
}

$model->addGlobalScope($tenant, function (Builder $builder) use ($tenant, $id, $model) {
if($this->getTenants()->first() && $this->getTenants()->first() != $id){
if ($this->getTenants()->first() && $this->getTenants()->first() != $id) {
$id = $this->getTenants()->first();
}

Expand All @@ -193,6 +194,7 @@ public function newModel(Model $model)
if ($this->tenants->isEmpty()) {
// No tenants yet, defer scoping to a later stage
$this->deferredModels->push($model);

return;
}

Expand Down

0 comments on commit 593a4fa

Please sign in to comment.