66 lines
1.7 KiB
PHP
66 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Seeder;
|
|
use Koneko\VuexyStoreManager\Models\Currency;
|
|
|
|
class CurrencySeeder extends Seeder
|
|
{
|
|
/**
|
|
* Lista de divisas a insertar.
|
|
*/
|
|
protected static array $divisas = [
|
|
[
|
|
'c_currency' => 'MXN',
|
|
'symbol' => '$',
|
|
'auto_update_exchange_rates' => true,
|
|
'refresh_interval' => 24,
|
|
'status' => Currency::STATUS_ENABLED,
|
|
],
|
|
[
|
|
'c_currency' => 'USD',
|
|
'symbol' => '$',
|
|
'auto_update_exchange_rates' => true,
|
|
'refresh_interval' => 24,
|
|
'status' => Currency::STATUS_ENABLED,
|
|
],
|
|
[
|
|
'c_currency' => 'EUR',
|
|
'symbol' => '€',
|
|
'auto_update_exchange_rates' => true,
|
|
'refresh_interval' => 24,
|
|
'status' => Currency::STATUS_ENABLED,
|
|
],
|
|
[
|
|
'c_currency' => 'GBP',
|
|
'symbol' => '£',
|
|
'auto_update_exchange_rates' => true,
|
|
'refresh_interval' => 24,
|
|
'status' => Currency::STATUS_ENABLED,
|
|
],
|
|
[
|
|
'c_currency' => 'JPY',
|
|
'symbol' => '¥',
|
|
'auto_update_exchange_rates' => true,
|
|
'refresh_interval' => 24,
|
|
'status' => Currency::STATUS_ENABLED,
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run()
|
|
{
|
|
foreach (self::$divisas as $divisa) {
|
|
Currency::updateOrCreate(
|
|
['c_currency' => $divisa['c_currency']], // Clave única
|
|
$divisa // Valores a insertar/actualizar
|
|
);
|
|
}
|
|
|
|
$this->command->info('Divisas insertadas/actualizadas correctamente.');
|
|
}
|
|
}
|