Merge branch 'master' into Development

This commit is contained in:
Simon Pocrnjič
2025-11-20 18:53:49 +01:00
113 changed files with 2370 additions and 547 deletions
+1 -1
View File
@@ -2,8 +2,8 @@
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Segment;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Action>
@@ -11,43 +11,43 @@
*/
public function up(): void
{
Schema::create('person_types', function(Blueprint $table){
Schema::create('person_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('person_groups', function(Blueprint $table){
Schema::create('person_groups', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->string('color_tag', 50)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('phone_types', function(Blueprint $table){
Schema::create('phone_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('address_types', function(Blueprint $table){
Schema::create('address_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('person', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->unique();
@@ -55,11 +55,11 @@ public function up(): void
$table->string('first_name', 255)->nullable();
$table->string('last_name', 255)->nullable();
$table->string('full_name', 255)->nullable();
$table->enum('gender', ['m','w'])->nullable();
$table->enum('gender', ['m', 'w'])->nullable();
$table->date('birthday')->nullable();
$table->string('tax_number', 99)->nullable();
$table->string('social_security_number',99)->nullable();
$table->string('description',500)->nullable();
$table->string('social_security_number', 99)->nullable();
$table->string('description', 500)->nullable();
$table->foreignId('group_id')->references('id')->on('person_groups');
$table->foreignId('type_id')->references('id')->on('person_types');
$table->unsignedTinyInteger('active')->default(1);
@@ -68,12 +68,12 @@ public function up(): void
$table->timestamps();
});
Schema::create('person_phones', function(Blueprint $table){
Schema::create('person_phones', function (Blueprint $table) {
$table->id();
$table->string('nu',50);
$table->string('nu', 50);
$table->unsignedInteger('country_code')->nullable();
$table->foreignId('type_id')->references('id')->on('phone_types');
$table->string('description',125)->nullable();
$table->string('description', 125)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->softDeletes();
@@ -82,12 +82,12 @@ public function up(): void
});
Schema::create('person_addresses', function(Blueprint $table){
Schema::create('person_addresses', function (Blueprint $table) {
$table->id();
$table->string('address',150);
$table->string('address', 150);
$table->string('country')->nullable();
$table->foreignId('type_id')->references('id')->on('address_types');
$table->string('description',125)->nullable();
$table->string('description', 125)->nullable();
$table->foreignIdFor(\App\Models\Person\Person::class);
$table->unsignedTinyInteger('active')->default(1);
$table->softDeletes();
@@ -11,10 +11,10 @@
*/
public function up(): void
{
Schema::create('account_types', function(Blueprint $table){
Schema::create('account_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
@@ -11,26 +11,25 @@
*/
public function up(): void
{
Schema::create('debt_types', function(Blueprint $table){
Schema::create('debt_types', function (Blueprint $table) {
$table->id();
$table->string('name',50)->unique();
$table->string('description',125)->nullable();
$table->string('name', 50)->unique();
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('debts', function (Blueprint $table) {
$table->id();
$table->string('reference',125)->nullable();
$table->string('invoice_nu',125)->nullable();
$table->string('reference', 125)->nullable();
$table->string('invoice_nu', 125)->nullable();
$table->date('issue_date')->nullable();
$table->date('due_date')->nullable();
$table->decimal('amount', 11, 4)->nullable();
$table->decimal('interest', 11, 8)->nullable();
$table->date('interest_start_date')->nullable();
$table->string('description',125)->nullable();
$table->string('description', 125)->nullable();
$table->foreignId('account_id')->references('id')->on('accounts');
$table->foreignId('type_id')->references('id')->on('debt_types');
$table->unsignedTinyInteger('active')->default(1);
@@ -9,16 +9,15 @@
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('payment_types', function(Blueprint $table){
Schema::create('payment_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
});
Schema::create('payments', function (Blueprint $table) {
@@ -26,7 +25,7 @@ public function up(): void
$table->string('reference', 125)->nullable();
$table->string('payment_nu', 125)->nullable();
$table->date('payment_date')->nullable();
$table->decimal('amount',11,4)->nullable();
$table->decimal('amount', 11, 4)->nullable();
$table->foreignId('debt_id')->references('id')->on('debts');
$table->foreignId('type_id')->references('id')->on('payment_types');
$table->unsignedTinyInteger('active')->default(1);
@@ -11,10 +11,10 @@
*/
public function up(): void
{
Schema::create('contract_types', function(Blueprint $table){
Schema::create('contract_types', function (Blueprint $table) {
$table->id();
$table->string('name',50);
$table->string('description',125)->nullable();
$table->string('name', 50);
$table->string('description', 125)->nullable();
$table->softDeletes();
$table->timestamps();
@@ -12,9 +12,9 @@
public function up(): void
{
Schema::table('accounts', function (Blueprint $table) {
$table->decimal("initial_amount", 20, 4)->default(0);
$table->decimal("balance_amount", 20, 4)->default(0);
$table->date("promise_date")->nullable();
$table->decimal('initial_amount', 20, 4)->default(0);
$table->decimal('balance_amount', 20, 4)->default(0);
$table->date('promise_date')->nullable();
$table->index('balance_amount');
$table->index('promise_date');
});
@@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class extends Migration
{
/**
* Run the migrations.
*/
@@ -36,7 +37,7 @@ public function up(): void
$table->index('iban');
$table->softDeletes();
$table->timestamps();
});
}
@@ -10,35 +10,35 @@ public function up(): void
{
// People: unique by (tax_number, social_security_number, deleted_at)
Schema::table('person', function (Blueprint $table) {
if (!self::hasIndex('person', 'person_identity_unique')) {
if (! self::hasIndex('person', 'person_identity_unique')) {
$table->unique(['tax_number', 'social_security_number', 'deleted_at'], 'person_identity_unique');
}
});
// Phones: unique by (person_id, nu, country_code, deleted_at)
Schema::table('person_phones', function (Blueprint $table) {
if (!self::hasIndex('person_phones', 'person_phones_unique')) {
if (! self::hasIndex('person_phones', 'person_phones_unique')) {
$table->unique(['person_id', 'nu', 'country_code', 'deleted_at'], 'person_phones_unique');
}
});
// Addresses: unique by (person_id, address, country, deleted_at)
Schema::table('person_addresses', function (Blueprint $table) {
if (!self::hasIndex('person_addresses', 'person_addresses_unique')) {
if (! self::hasIndex('person_addresses', 'person_addresses_unique')) {
$table->unique(['person_id', 'address', 'country', 'deleted_at'], 'person_addresses_unique');
}
});
// Contracts: unique by (client_case_id, reference, deleted_at)
Schema::table('contracts', function (Blueprint $table) {
if (!self::hasIndex('contracts', 'contracts_reference_unique')) {
if (! self::hasIndex('contracts', 'contracts_reference_unique')) {
$table->unique(['client_case_id', 'reference', 'deleted_at'], 'contracts_reference_unique');
}
});
// Accounts: unique by (contract_id, reference, deleted_at)
Schema::table('accounts', function (Blueprint $table) {
if (!self::hasIndex('accounts', 'accounts_reference_unique')) {
if (! self::hasIndex('accounts', 'accounts_reference_unique')) {
$table->unique(['contract_id', 'reference', 'deleted_at'], 'accounts_reference_unique');
}
});
@@ -70,6 +70,7 @@ private static function hasIndex(string $table, string $index): bool
$connection = Schema::getConnection();
$schemaManager = $connection->getDoctrineSchemaManager();
$doctrineTable = $schemaManager->listTableDetails($table);
return $doctrineTable->hasIndex($index);
} catch (\Throwable $e) {
return false;
@@ -9,9 +9,9 @@
public function up(): void
{
Schema::table('accounts', function (Blueprint $table) {
if (!Schema::hasColumn('accounts', 'balance_amount')) {
if (! Schema::hasColumn('accounts', 'balance_amount')) {
$table->decimal('balance_amount', 18, 4)->nullable()->after('description');
$table->index('balance_amount');
}
@@ -9,7 +9,7 @@
public function up(): void
{
Schema::table('imports', function (Blueprint $table) {
if (!Schema::hasColumn('imports', 'import_template_id')) {
if (! Schema::hasColumn('imports', 'import_template_id')) {
$table->foreignId('import_template_id')->nullable();
}
// Add foreign key if not exists (Postgres will error if duplicate, so wrap in try/catch in runtime, but Schema builder doesn't support conditional FKs)
@@ -29,8 +29,9 @@ public function up(): void
$used = [];
foreach ($rows as $row) {
if (is_string($row->nu) && preg_match('/^[A-Za-z0-9]{6}$/', $row->nu)) {
if (!isset($used[$row->nu])) {
if (! isset($used[$row->nu])) {
$used[$row->nu] = true;
continue;
}
// duplicate will be regenerated below
@@ -9,7 +9,7 @@
public function up(): void
{
Schema::table('import_mappings', function (Blueprint $table) {
if (!Schema::hasColumn('import_mappings', 'position')) {
if (! Schema::hasColumn('import_mappings', 'position')) {
$table->unsignedInteger('position')->nullable()->after('options');
}
$table->index(['import_id', 'position']);
@@ -10,7 +10,7 @@
public function up(): void
{
Schema::table('import_mappings', function (Blueprint $table) {
if (!Schema::hasColumn('import_mappings', 'entity')) {
if (! Schema::hasColumn('import_mappings', 'entity')) {
$table->string('entity', 64)->nullable()->after('import_id');
}
$table->index(['import_id', 'entity']);
@@ -19,9 +19,11 @@ public function up(): void
// Backfill entity from target_field's first segment where possible
DB::table('import_mappings')->orderBy('id')->chunkById(1000, function ($rows) {
foreach ($rows as $row) {
if (!empty($row->entity)) continue;
if (! empty($row->entity)) {
continue;
}
$entity = null;
if (!empty($row->target_field)) {
if (! empty($row->target_field)) {
$parts = explode('.', $row->target_field);
$record = $parts[0] ?? null;
if ($record) {
@@ -49,7 +51,10 @@ public function down(): void
Schema::table('import_mappings', function (Blueprint $table) {
if (Schema::hasColumn('import_mappings', 'entity')) {
// drop composite index if exists
try { $table->dropIndex(['import_id', 'entity']); } catch (\Throwable $e) { /* ignore */ }
try {
$table->dropIndex(['import_id', 'entity']);
} catch (\Throwable $e) { /* ignore */
}
$table->dropColumn('entity');
}
});
@@ -10,7 +10,7 @@
public function up(): void
{
Schema::table('import_template_mappings', function (Blueprint $table) {
if (!Schema::hasColumn('import_template_mappings', 'entity')) {
if (! Schema::hasColumn('import_template_mappings', 'entity')) {
$table->string('entity', 64)->nullable()->after('import_template_id');
}
$table->index(['import_template_id', 'entity']);
@@ -19,9 +19,11 @@ public function up(): void
// Backfill entity from target_field first segment
DB::table('import_template_mappings')->orderBy('id')->chunkById(1000, function ($rows) {
foreach ($rows as $row) {
if (!empty($row->entity)) continue;
if (! empty($row->entity)) {
continue;
}
$entity = null;
if (!empty($row->target_field)) {
if (! empty($row->target_field)) {
$parts = explode('.', $row->target_field);
$record = $parts[0] ?? null;
if ($record) {
@@ -47,7 +49,10 @@ public function down(): void
{
Schema::table('import_template_mappings', function (Blueprint $table) {
if (Schema::hasColumn('import_template_mappings', 'entity')) {
try { $table->dropIndex(['import_template_id', 'entity']); } catch (\Throwable $e) { /* ignore */ }
try {
$table->dropIndex(['import_template_id', 'entity']);
} catch (\Throwable $e) { /* ignore */
}
$table->dropColumn('entity');
}
});
@@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class extends Migration
{
public function up(): void
{
Schema::create('field_job_settings', function (Blueprint $table) {
@@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
return new class extends Migration
{
public function up(): void
{
Schema::create('field_jobs', function (Blueprint $table) {
@@ -33,8 +33,8 @@ public function up(): void
$table->unique(['contract_type_id', 'segment_id']);
});
// Mark existing rows as initial
\DB::table('contract_configs')->update(['is_initial' => true]);
// Mark existing rows as initial
\DB::table('contract_configs')->update(['is_initial' => true]);
}
public function down(): void
@@ -26,9 +26,13 @@ public function up(): void
$keepFirst = true;
foreach ($rows as $row) {
if ($keepFirst) { $keepFirst = false; continue; }
if ($keepFirst) {
$keepFirst = false;
continue;
}
$base = mb_substr($row->reference, 0, 120);
$newRef = $base . '-' . $row->id;
$newRef = $base.'-'.$row->id;
DB::table('contracts')->where('id', $row->id)->update(['reference' => $newRef]);
}
}
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('active')->default(true)->after('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('active');
});
}
};
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class AccountSeeder extends Seeder
+20 -21
View File
@@ -4,7 +4,6 @@
use App\Models\Action;
use App\Models\Decision;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ActionSeeder extends Seeder
@@ -17,34 +16,34 @@ public function run(): void
Action::create([
'name' => 'KLIC - IZHODNI',
'color_tag' => '',
'segment_id' => 1
'segment_id' => 1,
]);
Action::create([
'name' => 'KLIC - VHODNI',
'color_tag' => '',
'segment_id' => 1
'segment_id' => 1,
]);
Action::create([
'name' => 'ePOŠTA',
'color_tag' => '',
'segment_id' => 1
'segment_id' => 1,
]);
Action::create([
'name' => 'VROČANJE',
'color_tag' => '',
'segment_id' => 1
'segment_id' => 1,
]);
Action::create([
'name' => 'SMS',
'color_tag' => '',
'segment_id' => 1
'segment_id' => 1,
]);
//------- 1
// ------- 1
Decision::create([
'name' => 'Obljuba',
'color_tag' => '',
@@ -52,15 +51,15 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 1,
'decision_id' => 1
'decision_id' => 1,
]);
\DB::table('action_decision')->insert([
'action_id' => 2,
'decision_id' => 1
'decision_id' => 1,
]);
//------- 2
// ------- 2
Decision::create([
'name' => 'Poslana',
'color_tag' => '',
@@ -68,10 +67,10 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 3,
'decision_id' => 2
'decision_id' => 2,
]);
//-------- 3
// -------- 3
Decision::create([
'name' => 'Prejeta',
'color_tag' => '',
@@ -79,10 +78,10 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 3,
'decision_id' => 3
'decision_id' => 3,
]);
//--------- 4
// --------- 4
Decision::create([
'name' => 'Neuspešna',
'color_tag' => '',
@@ -90,10 +89,10 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 4,
'decision_id' => 4
'decision_id' => 4,
]);
//--------- 5
// --------- 5
Decision::create([
'name' => 'Uspešna',
'color_tag' => '',
@@ -101,10 +100,10 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 4,
'decision_id' => 5
'decision_id' => 5,
]);
//--------- 6
// --------- 6
Decision::create([
'name' => 'Poslan SMS',
'color_tag' => '',
@@ -112,10 +111,10 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 5,
'decision_id' => 6
'decision_id' => 6,
]);
//--------- 7
// --------- 7
Decision::create([
'name' => 'Prejet SMS',
'color_tag' => '',
@@ -123,7 +122,7 @@ public function run(): void
\DB::table('action_decision')->insert([
'action_id' => 5,
'decision_id' => 7
'decision_id' => 7,
]);
}
}
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ActivitySeeder extends Seeder
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ClientCaseSeeder extends Seeder
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class ClientSeeder extends Seeder
+3 -7
View File
@@ -2,9 +2,7 @@
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
@@ -12,16 +10,14 @@ class ContractSeeder extends Seeder
/**
* Run the database seeds.
*/
public function run(): void
{
$contractType = [
[ 'name' => 'delivery', 'description' => ''],
[ 'name' => 'leasing', 'description' => '']
['name' => 'delivery', 'description' => ''],
['name' => 'leasing', 'description' => ''],
];
foreach($contractType as $ct){
foreach ($contractType as $ct) {
ContractType::create($ct);
}
}
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DebtSeeder extends Seeder
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DecisionSeeder extends Seeder
+16 -1
View File
@@ -125,6 +125,21 @@ public function run(): void
],
'ui' => ['order' => 7],
],
[
'key' => 'case_objects',
'canonical_root' => 'case_object',
'label' => 'Case Objects',
'fields' => ['reference', 'name', 'description', 'type', 'contract_id'],
'aliases' => ['case_object', 'case_objects', 'object', 'objects', 'predmet', 'predmeti'],
'rules' => [
['pattern' => '/^(sklic|reference|ref)\b/i', 'field' => 'reference'],
['pattern' => '/^(ime|naziv|name|title)\b/i', 'field' => 'name'],
['pattern' => '/^(tip|vrsta|type|kind)\b/i', 'field' => 'type'],
['pattern' => '/^(komentar|opis|opomba|comment|description|note)\b/i', 'field' => 'description'],
['pattern' => '/^(contract\s*id|contract_id|pogodba\s*id|pogodba_id)\b/i', 'field' => 'contract_id'],
],
'ui' => ['order' => 8],
],
[
'key' => 'payments',
'canonical_root' => 'payment',
@@ -158,7 +173,7 @@ public function run(): void
['pattern' => '/^(datum|date|paid\s*at|payment\s*date)\b/i', 'field' => 'payment_date'],
['pattern' => '/^(znesek|amount|vplacilo|vplačilo|placilo|plačilo)\b/i', 'field' => 'amount'],
],
'ui' => ['order' => 8],
'ui' => ['order' => 9],
],
];
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PaymentSeeder extends Seeder
+37 -38
View File
@@ -19,54 +19,53 @@ public function run(): void
{
//
$personTypes = [
[ 'name' => 'legal', 'description' => ''],
[ 'name' => 'natural', 'description' => '']
['name' => 'legal', 'description' => ''],
['name' => 'natural', 'description' => ''],
];
$personGroups = [
[ 'name' => 'naročnik', 'description' => '', 'color_tag' => 'blue-500'],
[ 'name' => 'primer naročnika', 'description' => '', 'color_tag' => 'red-400']
['name' => 'naročnik', 'description' => '', 'color_tag' => 'blue-500'],
['name' => 'primer naročnika', 'description' => '', 'color_tag' => 'red-400'],
];
$phoneTypes = [
[ 'name' => 'mobile', 'description' => ''],
[ 'name' => 'telephone', 'description' => '']
['name' => 'mobile', 'description' => ''],
['name' => 'telephone', 'description' => ''],
];
$addressTypes = [
[ 'name' => 'permanent', 'description' => ''],
[ 'name' => 'temporary', 'description' => '']
['name' => 'permanent', 'description' => ''],
['name' => 'temporary', 'description' => ''],
];
$contractTypes = [
['name' => 'early', 'description' => ''],
['name' => 'hard', 'description' => '']
['name' => 'hard', 'description' => ''],
];
foreach($personTypes as $pt){
foreach ($personTypes as $pt) {
PersonType::create($pt);
}
foreach($personGroups as $pg){
foreach ($personGroups as $pg) {
PersonGroup::create($pg);
}
foreach($phoneTypes as $pt){
foreach ($phoneTypes as $pt) {
PhoneType::create($pt);
}
foreach($addressTypes as $at){
foreach ($addressTypes as $at) {
AddressType::create($at);
}
foreach($contractTypes as $ct){
foreach ($contractTypes as $ct) {
ContractType::create($ct);
}
//client
// client
Person::create([
'nu' => rand(100000,200000),
'nu' => rand(100000, 200000),
'first_name' => '',
'last_name' => '',
'full_name' => 'Naročnik d.o.o.',
@@ -77,12 +76,12 @@ public function run(): void
'description' => 'sdwwf',
'group_id' => 1,
'type_id' => 1,
'user_id' => 1
'user_id' => 1,
])->client()->create();
//debtors
// debtors
Person::create([
'nu' => rand(100000,200000),
'nu' => rand(100000, 200000),
'first_name' => 'test',
'last_name' => 'test',
'full_name' => 'test test',
@@ -93,13 +92,13 @@ public function run(): void
'description' => 'sdwwf',
'group_id' => 2,
'type_id' => 2,
'user_id' => 1
'user_id' => 1,
])->clientCase()->create([
'client_id' => 1
'client_id' => 1,
]);
Person::create([
'nu' => rand(100000,200000),
'nu' => rand(100000, 200000),
'first_name' => 'test2',
'last_name' => 'test2',
'full_name' => 'test2 test2',
@@ -110,14 +109,14 @@ public function run(): void
'description' => 'dw323',
'group_id' => 2,
'type_id' => 2,
'user_id' => 1
'user_id' => 1,
])->clientCase()->create([
'client_id' => 1
'client_id' => 1,
]);
//client
// client
Person::create([
'nu' => rand(100000,200000),
'nu' => rand(100000, 200000),
'first_name' => '',
'last_name' => '',
'full_name' => 'test d.o.o.',
@@ -128,12 +127,12 @@ public function run(): void
'description' => 'sdwwf',
'group_id' => 1,
'type_id' => 1,
'user_id' => 1
'user_id' => 1,
])->client()->create();
//debtors
// debtors
Person::create([
'nu' => rand(100000,200000),
'nu' => rand(100000, 200000),
'first_name' => 'test3',
'last_name' => 'test3',
'full_name' => 'test3 test3',
@@ -144,15 +143,15 @@ public function run(): void
'description' => 'sdwwf',
'group_id' => 2,
'type_id' => 2,
'user_id' => 1
'user_id' => 1,
])->clientCase()->create(
[
'client_id' => 2
'client_id' => 2,
]
);
Person::create([
'nu' => rand(100000,200000),
'nu' => rand(100000, 200000),
'first_name' => '',
'last_name' => '',
'full_name' => 'test4 d.o.o.',
@@ -163,12 +162,12 @@ public function run(): void
'description' => 'dw323',
'group_id' => 2,
'type_id' => 1,
'user_id' => 1
'user_id' => 1,
])->clientCase()->create(
[
'client_id' => 2
'client_id' => 2,
]
);
}
}
-1
View File
@@ -2,7 +2,6 @@
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class PostSeeder extends Seeder
@@ -5,7 +5,6 @@
use App\Models\Permission;
use App\Models\Role;
use App\Models\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Seeder;
class RolePermissionSeeder extends Seeder
+3 -4
View File
@@ -3,7 +3,6 @@
namespace Database\Seeders;
use App\Models\Segment;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class SegmentSeeder extends Seeder
@@ -14,11 +13,11 @@ class SegmentSeeder extends Seeder
public function run(): void
{
$sements = [
[ 'name' => 'global', 'description' => ''],
[ 'name' => 'terrain', 'description' => '']
['name' => 'global', 'description' => ''],
['name' => 'terrain', 'description' => ''],
];
foreach($sements as $st){
foreach ($sements as $st) {
Segment::create($st);
}
}
@@ -21,6 +21,7 @@ public function run(): void
if (! $user) {
$this->command?->warn("User {$email} not found nothing updated.");
return;
}