199 lines
5.4 KiB
PHP
199 lines
5.4 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Contract;
|
|
use App\Models\ContractType;
|
|
use App\Models\Person\AddressType;
|
|
use App\Models\Person\Person;
|
|
use App\Models\Person\PersonGroup;
|
|
use App\Models\Person\PersonType;
|
|
use App\Models\Person\PhoneType;
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class PersonSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
//
|
|
$personTypes = [
|
|
[ 'name' => 'legal', 'description' => ''],
|
|
[ 'name' => 'natural', 'description' => '']
|
|
];
|
|
|
|
$personGroups = [
|
|
[ 'name' => 'client', 'description' => ''],
|
|
[ 'name' => 'debtor', 'description' => '']
|
|
];
|
|
|
|
$phoneTypes = [
|
|
[ 'name' => 'mobile', 'description' => ''],
|
|
[ 'name' => 'telephone', 'description' => '']
|
|
];
|
|
|
|
$addressTypes = [
|
|
[ 'name' => 'permanent', 'description' => ''],
|
|
[ 'name' => 'temporary', 'description' => '']
|
|
];
|
|
|
|
$contractTypes = [
|
|
['name' => 'early', 'description' => ''],
|
|
['name' => 'hard', 'description' => '']
|
|
];
|
|
|
|
|
|
foreach($personTypes as $pt){
|
|
PersonType::create($pt);
|
|
}
|
|
|
|
foreach($personGroups as $pg){
|
|
PersonGroup::create($pg);
|
|
}
|
|
|
|
foreach($phoneTypes as $pt){
|
|
PhoneType::create($pt);
|
|
}
|
|
|
|
foreach($addressTypes as $at){
|
|
AddressType::create($at);
|
|
}
|
|
|
|
foreach($contractTypes as $ct){
|
|
ContractType::create($ct);
|
|
}
|
|
|
|
//client
|
|
Person::create([
|
|
'nu' => rand(100000,200000),
|
|
'first_name' => '',
|
|
'last_name' => '',
|
|
'full_name' => 'test d.o.o.',
|
|
'gender' => 'm',
|
|
'birthday' => '2000-01-01',
|
|
'tax_number' => '22424345',
|
|
'social_security_number' => '22525252233656',
|
|
'description' => 'sdwwf',
|
|
'group_id' => 1,
|
|
'type_id' => 1,
|
|
'user_id' => 1
|
|
]);
|
|
|
|
//debtors
|
|
Person::create([
|
|
'nu' => rand(100000,200000),
|
|
'first_name' => 'test',
|
|
'last_name' => 'test',
|
|
'full_name' => 'test test',
|
|
'gender' => 'm',
|
|
'birthday' => '2000-01-01',
|
|
'tax_number' => '22424345',
|
|
'social_security_number' => '22525252233656',
|
|
'description' => 'sdwwf',
|
|
'group_id' => 2,
|
|
'type_id' => 2,
|
|
'user_id' => 1
|
|
]);
|
|
|
|
Person::create([
|
|
'nu' => rand(100000,200000),
|
|
'first_name' => 'test2',
|
|
'last_name' => 'test2',
|
|
'full_name' => 'test2 test2',
|
|
'gender' => 'm',
|
|
'birthday' => '1992-01-01',
|
|
'tax_number' => '2425233',
|
|
'social_security_number' => '22522312314',
|
|
'description' => 'dw323',
|
|
'group_id' => 2,
|
|
'type_id' => 2,
|
|
'user_id' => 1
|
|
]);
|
|
|
|
//client
|
|
Person::create([
|
|
'nu' => rand(100000,200000),
|
|
'first_name' => '',
|
|
'last_name' => '',
|
|
'full_name' => 'test d.o.o.',
|
|
'gender' => 'm',
|
|
'birthday' => '2000-01-01',
|
|
'tax_number' => '22424345',
|
|
'social_security_number' => '22525252233656',
|
|
'description' => 'sdwwf',
|
|
'group_id' => 1,
|
|
'type_id' => 1,
|
|
'user_id' => 1
|
|
]);
|
|
|
|
//debtors
|
|
Person::create([
|
|
'nu' => rand(100000,200000),
|
|
'first_name' => 'test3',
|
|
'last_name' => 'test3',
|
|
'full_name' => 'test3 test3',
|
|
'gender' => 'm',
|
|
'birthday' => '2000-01-01',
|
|
'tax_number' => '22424345',
|
|
'social_security_number' => '22525252233656',
|
|
'description' => 'sdwwf',
|
|
'group_id' => 2,
|
|
'type_id' => 2,
|
|
'user_id' => 1
|
|
]);
|
|
|
|
Person::create([
|
|
'nu' => rand(100000,200000),
|
|
'first_name' => '',
|
|
'last_name' => '',
|
|
'full_name' => 'test4 d.o.o.',
|
|
'gender' => 'm',
|
|
'birthday' => '1992-01-01',
|
|
'tax_number' => '2425233',
|
|
'social_security_number' => '22522312314',
|
|
'description' => 'dw323',
|
|
'group_id' => 2,
|
|
'type_id' => 1,
|
|
'user_id' => 1
|
|
]);
|
|
|
|
|
|
//contract
|
|
Contract::create([
|
|
'reference' => '111111222',
|
|
'start_date' => date('Y-m-d'),
|
|
'client_id' => 1,
|
|
'debtor_id' => 2,
|
|
'type_id' => 1
|
|
]);
|
|
|
|
Contract::create([
|
|
'reference' => '111111224',
|
|
'start_date' => date('Y-m-d'),
|
|
'client_id' => 1,
|
|
'debtor_id' => 3,
|
|
'type_id' => 1
|
|
]);
|
|
|
|
Contract::create([
|
|
'reference' => '211111222',
|
|
'start_date' => date('Y-m-d'),
|
|
'client_id' => 4,
|
|
'debtor_id' => 5,
|
|
'type_id' => 1
|
|
]);
|
|
|
|
Contract::create([
|
|
'reference' => '211111224',
|
|
'start_date' => date('Y-m-d'),
|
|
'client_id' => 4,
|
|
'debtor_id' => 6,
|
|
'type_id' => 1
|
|
]);
|
|
|
|
}
|
|
}
|