65 lines
2.3 KiB
PHP
65 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Currency;
|
|
use App\Models\Tenant;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class TenantSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* Creates two sample tenants representing different locales
|
|
* and regional settings — one Persian (Jalali calendar, IRR currency)
|
|
* and one English (Gregorian calendar, USD currency).
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$irr = Currency::where('code', 'IRR')->firstOrFail();
|
|
$usd = Currency::where('code', 'USD')->firstOrFail();
|
|
|
|
$tenants = [
|
|
[
|
|
'name' => 'سازندگی سپید',
|
|
'slug' => 'sepideh',
|
|
'domain' => 'sepideh.Vernova.ir',
|
|
'is_active' => true,
|
|
'default_locale' => 'fa',
|
|
'default_calendar' => 'jalali',
|
|
'base_currency_id' => $irr->id,
|
|
'allow_multi_currency' => true,
|
|
'logo_path' => null,
|
|
'settings' => [
|
|
'week_start' => 'saturday',
|
|
'working_days' => ['saturday', 'sunday', 'monday', 'tuesday', 'wednesday'],
|
|
'fiscal_year_start' => '1403-01-01',
|
|
],
|
|
],
|
|
[
|
|
'name' => 'Global Construction Co.',
|
|
'slug' => 'global',
|
|
'domain' => 'global.Vernova.ir',
|
|
'is_active' => true,
|
|
'default_locale' => 'en',
|
|
'default_calendar' => 'gregorian',
|
|
'base_currency_id' => $usd->id,
|
|
'allow_multi_currency' => true,
|
|
'logo_path' => null,
|
|
'settings' => [
|
|
'week_start' => 'monday',
|
|
'working_days' => ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'],
|
|
'fiscal_year_start' => '2024-01-01',
|
|
],
|
|
],
|
|
];
|
|
|
|
foreach ($tenants as $tenantData) {
|
|
Tenant::create($tenantData);
|
|
}
|
|
|
|
$this->command->info('Tenants seeded: ' . count($tenants) . ' records created.');
|
|
}
|
|
}
|