mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:34:04 +00:00
* Use seeder params in tenants:seed instead of just the automatic seeder * Left trim - from option names * Use no seeder params for tests
38 lines
818 B
PHP
38 lines
818 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Stancl\Tenancy\Jobs;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
use Stancl\Tenancy\Tenant;
|
|
|
|
class QueuedTenantDatabaseSeeder implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
/** @var string */
|
|
protected $tenantId;
|
|
|
|
public function __construct(Tenant $tenant)
|
|
{
|
|
$this->tenantId = $tenant->id;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
Artisan::call('tenants:seed', [
|
|
'--tenants' => [$this->tenantId],
|
|
]);
|
|
}
|
|
}
|