ifnex/04_Laravel/database/seeders/SystemSettingSeeder.php

32 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Database\Seeders;
use App\Models\SystemSetting;
use Illuminate\Database\Seeder;
class SystemSettingSeeder extends Seeder
{
public function run(): void
{
$settings = [
// تنظیمات مالی — همه نرخ‌ها به ریال (IRR)
['key' => 'vat_rate', 'value' => 0.0900, 'description' => 'نرخ مالیات بر ارزش افزوده — ۹٪'],
['key' => 'packing_cost_default', 'value' => 100000.0, 'description' => 'هزینه بسته‌بندی پیش‌فرض (ریال)'],
['key' => 'profit_margin', 'value' => 1.2500, 'description' => 'ضریب سود (۱.۲۵ = ۲۵٪ سود)'],
// ⚠️ نرخ‌های ارز در جدول currencies ذخیره می‌شوند، نه در SystemSettings.
// این مقادیر فقط برای backward-compatibility نگه داشته شده‌اند و نباید استفاده شوند.
// در نسخه Pro این کلیدها حذف خواهند شد و فقط از جدول currencies خوانده می‌شود.
['key' => 'aed_to_irr', 'value' => 7419700.0, 'description' => '[Deprecated] نرخ درهم به ریال — نرخ واقعی از جدول currencies خوانده شود'],
['key' => 'usd_to_irr', 'value' => 27150000.0, 'description' => '[Deprecated] نرخ دلار به ریال'],
['key' => 'cny_to_irr', 'value' => 4046000.0, 'description' => '[Deprecated] نرخ یوان به ریال'],
['key' => 'eur_to_irr', 'value' => 3013000.0, 'description' => '[Deprecated] نرخ یورو به ریال'],
];
foreach ($settings as $setting) {
SystemSetting::updateOrCreate(['key' => $setting['key']], $setting);
}
}
}