Add initial Code

This commit is contained in:
2025-10-20 08:57:51 +02:00
parent d204098d8e
commit 9da301c4f1
447 changed files with 34393 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Customer;
use App\Models\Contact;
use App\Models\Invoice;
use App\Models\LineItem;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call([
PaymentTermsSeeder::class,
SettingsTableSeeder::class
]);
User::factory()->create([
'name' => 'Daniel Stock',
'email' => 'daniel.stock@tooloop.de',
'password' => bcrypt('6T0az2JGO5oA'),
]);
// Create customers with contacts
Customer::factory(20)->create()->each(function ($customer) {
// Create a primary contact for each customer
Contact::factory()->create([
'customer_id' => $customer->id,
'is_primary' => true,
]);
// Create additional contacts for each customer
Contact::factory(rand(1, 3))->create([
'customer_id' => $customer->id,
]);
});
// Create invoices
Invoice::factory(20)->create()->each(function ($invoice) {
// Create line items for each invoice
LineItem::factory(rand(5, 10))->create([
'invoice_id' => $invoice->id,
]);
});
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Database\Seeders;
use App\Models\PaymentTerms;
use Illuminate\Database\Seeder;
class PaymentTermsSeeder extends Seeder
{
public function run(): void
{
PaymentTerms::create([
'name' => 'prepaid',
'description' => 'Vorkasse',
'is_fixed' => true,
'days' => null
]);
PaymentTerms::create([
'name' => 'onReceipt',
'is_fixed' => true,
'days' => null
]);
PaymentTerms::create([
'name' => 'daysAfterInvoice',
'description' => 'Zahlungsziel in Tagen',
'is_fixed' => false,
'days' => 14
]);
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Setting;
class SettingsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Setting::firstOrCreate([], [
'invoice_number_format' => 'RE-{number}',
'invoice_number_start' => 1,
]);
}
}