akaunting/database/seeds/Categories.php

72 lines
1.7 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;
2017-09-14 22:21:00 +03:00
use App\Models\Setting\Category;
use Illuminate\Database\Seeder;
class Categories extends Seeder
{
/**
* 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,
'name' => trans_choice('general.transfers', 1),
'type' => 'other',
2019-11-16 10:21:14 +03:00
'color' => '#3c3f72',
2019-12-25 23:48:13 +03:00
'enabled' => '1',
2017-09-14 22:21:00 +03:00
],
[
'company_id' => $company_id,
2019-12-25 23:48:13 +03:00
'name' => trans('demo.categories.deposit'),
2017-09-14 22:21:00 +03:00
'type' => 'income',
2019-11-16 10:21:14 +03:00
'color' => '#efad32',
2019-12-25 23:48:13 +03:00
'enabled' => '1',
2017-09-14 22:21:00 +03:00
],
[
'company_id' => $company_id,
2019-12-25 23:48:13 +03:00
'name' => trans('demo.categories.sales'),
2017-09-14 22:21:00 +03:00
'type' => 'income',
'color' => '#6da252',
2019-12-25 23:48:13 +03:00
'enabled' => '1',
2017-09-14 22:21:00 +03:00
],
[
'company_id' => $company_id,
2018-05-05 11:59:21 +03:00
'name' => trans_choice('general.others', 1),
2017-09-14 22:21:00 +03:00
'type' => 'expense',
2019-11-16 10:21:14 +03:00
'color' => '#e5e5e5',
2019-12-25 23:48:13 +03:00
'enabled' => '1',
2017-09-14 22:21:00 +03:00
],
[
'company_id' => $company_id,
'name' => trans('general.general'),
'type' => 'item',
2019-11-16 10:21:14 +03:00
'color' => '#328aef',
2019-12-25 23:48:13 +03:00
'enabled' => '1',
2017-09-14 22:21:00 +03:00
],
];
foreach ($rows as $row) {
Category::create($row);
}
}
}