1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 21:14:03 +00:00

Fix code style (php-cs-fixer)

This commit is contained in:
PHP CS Fixer 2022-07-22 07:28:16 +00:00
parent 095c2e1380
commit c6161f6997
8 changed files with 7 additions and 25 deletions

View file

@ -28,8 +28,6 @@ class ClearPendingTenants extends Command
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
@ -50,7 +48,6 @@ class ClearPendingTenants extends Command
}
}
$deletedPendingCount = tenancy()
->query()
->onlyPending()

View file

@ -24,8 +24,6 @@ class CreatePendingTenants extends Command
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
@ -53,8 +51,6 @@ class CreatePendingTenants extends Command
/**
* Calculate the number of currently deployed pending tenants.
*
* @return int
*/
private function getPendingTenantCount(): int
{

View file

@ -12,7 +12,7 @@ trait HasATenantsOption
protected function getOptions()
{
return array_merge([
['tenants', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '', null],
['tenants', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_OPTIONAL, '', null],
['with-pending', null, InputOption::VALUE_NONE, 'include pending tenants in query', null],
], parent::getOptions());
}

View file

@ -5,10 +5,10 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Database\Concerns;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Events\PullingPendingTenant;
use Stancl\Tenancy\Events\PendingTenantPulled;
use Stancl\Tenancy\Events\CreatingPendingTenant;
use Stancl\Tenancy\Events\PendingTenantCreated;
use Stancl\Tenancy\Events\PendingTenantPulled;
use Stancl\Tenancy\Events\PullingPendingTenant;
/**
* @property $pending_since
@ -39,7 +39,6 @@ trait HasPending
$this->casts['pending_since'] = 'timestamp';
}
/**
* Determine if the model instance is in a pending state.
*
@ -59,7 +58,7 @@ trait HasPending
// Add the pending value only after creating the model
// To ensure it's not marked as pending until finishing running the migrations, seeders, etc.
$tenant->update([
'pending_since' => now()->timestamp
'pending_since' => now()->timestamp,
]);
event(new PendingTenantCreated($tenant));
@ -80,7 +79,7 @@ trait HasPending
event(new PullingPendingTenant($tenant));
$tenant->update([
'pending_since' => null
'pending_since' => null,
]);
event(new PendingTenantPulled($tenant));

View file

@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Scope;
class PendingScope implements Scope
{
/**
* All of the extensions to be added to the builder.
*
@ -21,13 +20,11 @@ class PendingScope implements Scope
/**
* Apply the scope to a given Eloquent query builder.
*
* @param Builder $builder
* @param Model $model
* @return void
*/
public function apply(Builder $builder, Model $model)
{
$builder->when(! config('tenancy.pending.include_in_queries'), function (Builder $builder){
$builder->when(! config('tenancy.pending.include_in_queries'), function (Builder $builder) {
$builder->whereNull('data->pending_since');
});
}
@ -35,7 +32,6 @@ class PendingScope implements Scope
/**
* Extend the query builder with the needed functions.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
public function extend(Builder $builder)
@ -47,7 +43,6 @@ class PendingScope implements Scope
/**
* Add the with-pending extension to the builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
protected function addWithPending(Builder $builder)
@ -64,13 +59,11 @@ class PendingScope implements Scope
/**
* Add the without-pending extension to the builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
protected function addWithoutPending(Builder $builder)
{
$builder->macro('withoutPending', function (Builder $builder) {
$builder->withoutGlobalScope($this)
->whereNull('data->pending_since')
->orWhereNull('data');
@ -82,7 +75,6 @@ class PendingScope implements Scope
/**
* Add the only-pending extension to the builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
protected function addOnlyPending(Builder $builder)

View file

@ -10,7 +10,6 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Artisan;
use Stancl\Tenancy\Contracts\TenantWithDatabase;
class ClearPendingTenants implements ShouldQueue
{

View file

@ -10,7 +10,6 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Artisan;
use Stancl\Tenancy\Contracts\TenantWithDatabase;
class CreatePendingTenants implements ShouldQueue
{

View file

@ -135,7 +135,7 @@ class Tenancy
{
$query = $this->model()->newQuery();
if (is_bool($withPending) && $this->model()::hasGlobalScope(PendingScope::class)){
if (is_bool($withPending) && $this->model()::hasGlobalScope(PendingScope::class)) {
$query->withPending($withPending);
}
// Convert null to all tenants