mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-15 05:24:04 +00:00
get phpstan errors down from 252 to 189
This commit is contained in:
parent
fb8b9c1614
commit
8af354c20e
40 changed files with 119 additions and 115 deletions
|
|
@ -19,13 +19,9 @@ class CreateDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var TenantWithDatabase|Model */
|
||||
protected $tenant;
|
||||
|
||||
public function __construct(TenantWithDatabase $tenant)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
}
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
||||
public function handle(DatabaseManager $databaseManager)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Stancl\Tenancy\Jobs;
|
|||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
|
@ -17,15 +18,11 @@ class DeleteDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var TenantWithDatabase */
|
||||
protected $tenant;
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
||||
public function __construct(TenantWithDatabase $tenant)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
event(new DeletingDatabase($this->tenant));
|
||||
|
||||
|
|
|
|||
|
|
@ -5,24 +5,26 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Stancl\Tenancy\Database\Contracts\TenantWithDatabase;
|
||||
use Stancl\Tenancy\Database\Concerns\HasDomains;
|
||||
|
||||
class DeleteDomains
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var TenantWithDatabase */
|
||||
protected $tenant;
|
||||
/** @var TenantWithDatabase&Model&HasDomains */ // todo unresolvable type for phpstan
|
||||
protected TenantWithDatabase&Model $tenant;
|
||||
|
||||
public function __construct(TenantWithDatabase $tenant)
|
||||
public function __construct(TenantWithDatabase&Model $tenant)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
$this->tenant->domains->each->delete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Stancl\Tenancy\Jobs;
|
|||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
|
@ -16,20 +17,11 @@ class MigrateDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var TenantWithDatabase */
|
||||
protected $tenant;
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
||||
public function __construct(TenantWithDatabase $tenant)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
Artisan::call('tenants:migrate', [
|
||||
'--tenants' => [$this->tenant->getTenantKey()],
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Stancl\Tenancy\Jobs;
|
|||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
|
@ -16,20 +17,11 @@ class SeedDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/** @var TenantWithDatabase */
|
||||
protected $tenant;
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
||||
public function __construct(TenantWithDatabase $tenant)
|
||||
{
|
||||
$this->tenant = $tenant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): void
|
||||
{
|
||||
Artisan::call('tenants:seed', [
|
||||
'--tenants' => [$this->tenant->getTenantKey()],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue