first commit

This commit is contained in:
Simon Pocrnjič
2024-10-28 21:08:16 +01:00
commit 90a5858320
199 changed files with 21177 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class AccountSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace Database\Seeders;
use App\Models\Contract;
use App\Models\ContractType;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ContractSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$contractType = [
[ 'name' => 'delivery', 'description' => ''],
[ 'name' => 'leasing', 'description' => '']
];
foreach($contractType as $ct){
ContractType::create($ct);
}
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use App\Models\Person\PersonType;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Support\Facades\Hash;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
'password' => Hash::make("password")
]);
$this->call([
PersonSeeder::class,
SegmentSeeder::class
]);
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DebtSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PaymentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}
+198
View File
@@ -0,0 +1,198 @@
<?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
]);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace Database\Seeders;
use App\Models\Segment;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class SegmentSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$sements = [
[ 'name' => 'global', 'description' => ''],
[ 'name' => 'terrain', 'description' => '']
];
foreach($sements as $st){
Segment::create($st);
}
}
}