1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 21:54:03 +00:00

Apply fixes from StyleCI

This commit is contained in:
stancl 2020-05-22 09:01:31 +00:00 committed by StyleCI Bot
parent 1798ca9c85
commit 6955512a6b
133 changed files with 379 additions and 203 deletions

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Database\ParentModelScope;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Contracts\Tenant;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
trait CentralConnection

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
/**

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Contracts\TenantWithDatabase;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Contracts\Domain;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Illuminate\Validation\Rules\Exists;
@ -16,4 +18,4 @@ trait HasScopedValidationRules
{
return (new Exists($table, $column))->where(BelongsToTenant::$tenantIdColumn, $this->getTenantKey());
}
}
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Carbon\Carbon;
@ -15,4 +17,4 @@ trait MaintenanceMode
'allowed' => $data['allowed'] ?? [],
]]);
}
}
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
/**

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Contracts\Syncable;
@ -12,7 +14,6 @@ trait ResourceSyncing
{
static::saved(function (Syncable $model) {
/** @var ResourceSyncing $model */
$model->triggerSyncEvent();
});

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
trait TenantConnection

View file

@ -1,13 +1,15 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Models;
use Illuminate\Database\Eloquent\Model;
use Stancl\Tenancy\Contracts;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Database\Concerns\CentralConnection;
use Stancl\Tenancy\Events;
use Stancl\Tenancy\Exceptions\DomainOccupiedByOtherTenantException;
use Stancl\Tenancy\Contracts;
use Stancl\Tenancy\Database\Concerns\CentralConnection;
/**
* @property string $domain
@ -25,8 +27,8 @@ class Domain extends Model implements Contracts\Domain
{
parent::boot();
$ensureDomainIsNotOccupied = function (Domain $self) {
if ($domain = Domain::where('domain', $self->domain)->first()) {
$ensureDomainIsNotOccupied = function (self $self) {
if ($domain = self::where('domain', $self->domain)->first()) {
if ($domain->getKey() !== $self->getKey()) {
throw new DomainOccupiedByOtherTenantException($self->domain);
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Models;
use Carbon\Carbon;
@ -38,4 +40,4 @@ class ImpersonationToken extends Model
$model->auth_guard = $model->auth_guard ?? config('auth.defaults.guard');
});
}
}
}

View file

@ -1,20 +1,22 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Stancl\Tenancy\Events;
use Stancl\Tenancy\Contracts;
use Stancl\Tenancy\Database\TenantCollection;
use Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Database\TenantCollection;
use Stancl\Tenancy\Events;
/**
* @property string|int $id
* @property Carbon $created_at
* @property Carbon $updated_at
* @property array $data
*
*
* @method TenantCollection all()
*/
class Tenant extends Model implements Contracts\Tenant

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database\Models;
use Illuminate\Database\Eloquent\Relations\Pivot;
@ -19,4 +21,4 @@ class TenantPivot extends Pivot
}
});
}
}
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database;
use Illuminate\Database\Eloquent\Builder;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database;
use Illuminate\Database\Eloquent\Collection;
@ -20,4 +22,4 @@ class TenantCollection extends Collection
return $this;
}
}
}

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Database;
use Illuminate\Database\Eloquent\Builder;