akaunting/database/seeds/Currencies.php

54 lines
1.3 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace Database\Seeds;
2019-11-16 10:21:14 +03:00
use App\Abstracts\Model;
2021-09-06 14:46:42 +03:00
use App\Jobs\Setting\CreateCurrency;
use App\Traits\Jobs;
2017-09-14 22:21:00 +03:00
use Illuminate\Database\Seeder;
class Currencies extends Seeder
{
2021-09-06 14:46:42 +03:00
use Jobs;
2017-09-14 22:21:00 +03:00
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$this->create();
Model::reguard();
}
private function create()
{
2018-07-26 23:00:45 +03:00
$company_id = $this->command->argument('company');
2017-09-14 22:21:00 +03:00
$rows = [
[
'company_id' => $company_id,
2019-12-25 23:48:13 +03:00
'name' => trans('demo.currencies.usd'),
2017-09-14 22:21:00 +03:00
'code' => 'USD',
'rate' => '1.00',
'enabled' => '1',
2023-07-10 12:53:43 +03:00
'precision' => config('money.currencies.USD.precision'),
'symbol' => config('money.currencies.USD.symbol'),
'symbol_first' => config('money.currencies.USD.symbol_first'),
'decimal_mark' => config('money.currencies.USD.decimal_mark'),
'thousands_separator' => config('money.currencies.USD.thousands_separator'),
2017-09-14 22:21:00 +03:00
],
];
foreach ($rows as $row) {
2021-09-10 00:31:39 +03:00
$row['created_from'] = 'core::seed';
2021-09-07 10:33:34 +03:00
2021-09-06 14:46:42 +03:00
$this->dispatch(new CreateCurrency($row));
2017-09-14 22:21:00 +03:00
}
}
}