seeder wip

This commit is contained in:
salam committed 2025-09-26 15:39:52 +02:00
1 parent 1d16946f20
commit 005924ef8a
34 files changed
+286 -325

No files matched your search

@@ -0,0 +1,30 @@
<?php
namespace Database\Factories;
use App\Models\Konto;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Auftraggeber>
*/
class AuftraggeberFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'konto_id' => Konto::all()->random()->id,
'name' => fake()->name(),
'address' => fake()->Address(),
'kontakt' => fake()->name(),
'country' => 'Österreich',
'email' => fake()->email(),
'phone' => fake()->PhoneNumber(),
];
}
}
+2 -1
View File
@@ -2,6 +2,7 @@
namespace Database\Factories;
use App\Models\Konto;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
@@ -17,7 +18,7 @@ class GutachterFactory extends Factory
public function definition(): array
{
return [
'konto_id' => fake()->numberBetween(1, 7),
'konto_id' => Konto::all()->random()->id,
'name' => fake()->name(),
'address' => fake()->Address(),
'country' => 'Österreich',
-1
View File
@@ -26,7 +26,6 @@ class KontoFactory extends Factory
'country' => 'Österreich',
'phone' => fake()->PhoneNumber(),
'uid_number' => 'ATU'.fake()->randomNumber(8, true),
'agb_akzeptiert' => 1,
'plan_id' => fake()->numberBetween(1, 3),
'guthaben' => fake()->numberBetween(4, 50),
'gueltig_bis' => fake()->dateTimeBetween('-1 month', '+5 month'),
+1
View File
@@ -32,6 +32,7 @@ class UserFactory extends Factory
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
'agb_akzeptiert' => 1,
];
}
@@ -22,7 +22,6 @@ return new class extends Migration
$table->string('country')->nullable();
$table->string('phone')->nullable();
$table->string('uid_number')->nullable();
$table->boolean('agb_akzeptiert')->default(false);
$table->string('plan_id')->default(1);
$table->string('guthaben')->default(0);
$table->timestamp('gueltig_bis')->nullable();
@@ -19,6 +19,7 @@ return new class extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->boolean('agb_akzeptiert')->default(false);
$table->text('app_authentication_secret')->nullable();
$table->text('app_authentication_recovery_codes')->nullable();
@@ -16,7 +16,7 @@ return new class extends Migration
$table->foreignId('konto_id')->constrained();
$table->string('name')->nullable();
$table->string('logo')->nullable();
$table->string('address')->nullable();
$table->text('address')->nullable();
$table->string('country')->nullable();
$table->string('phone')->nullable();
$table->string('email')->nullable();
@@ -14,12 +14,13 @@ return new class extends Migration
Schema::create('auftraggebers', function (Blueprint $table) {
$table->id();
$table->foreignId('konto_id')->constrained();
$table->string('name');
$table->string('logo');
$table->text('adresse')->nullable();
$table->string('kontaktperson')->nullable();
$table->string('name')->nullable();
$table->string('logo')->nullable();
$table->text('address')->nullable();
$table->string('country')->nullable();
$table->string('kontakt')->nullable();
$table->string('email')->email()->nullable();
$table->string('telefon')->tel()->nullable();
$table->string('phone')->tel()->nullable();
$table->timestamps();
});
}
+4 -3
View File
@@ -2,6 +2,7 @@
namespace Database\Seeders;
use App\Models\Auftraggeber;
use App\Models\Gutachter;
use App\Models\Konto;
use App\Models\User;
@@ -15,8 +16,8 @@ class DatabaseSeeder extends Seeder
public function run(): void
{
Konto::factory()->count(10)->create();
// Gutachter::factory()->create(30);
Gutachter::factory()->count(30)->create();
Auftraggeber::factory()->count(30)->create();
$this->call([
OrientierungenSeeder::class,
@@ -24,7 +25,7 @@ class DatabaseSeeder extends Seeder
RolesAndPermissionsSeeder::class,
]);
User::factory()->count(100)->create();
User::factory()->count(40)->create();
}
}
+3 -3
View File
@@ -12,10 +12,10 @@ class KontoSeeder extends Seeder
*/
public function run(): void
{
$sql = "INSERT INTO `kontos` (`id`, `title`, `gender`, `name`, `company`, `email`, `address`, `location`, `plz`, `country`, `phone`, `uid_number`, `agb_akzeptiert`, `option_id`, `gutachten_zahl`, `gutachten_zeit`, `gutachten_abgeschlossen`, `created_at`, `updated_at`)
$sql = "INSERT INTO `kontos` (`id`, `title`, `gender`, `name`, `company`, `email`, `address`, `location`, `plz`, `country`, `phone`, `uid_number`, `option_id`, `gutachten_zahl`, `gutachten_zeit`, `gutachten_abgeschlossen`, `created_at`, `updated_at`)
VALUES
('1', 'Architekt', 'Herr', 'Hanno Vogl-Fernheim', 'Architekt Vogl-Fernheim', 'office@vogl-fernheim.eu', 'Richardsweg 1', 'Innsbruck', '6020', 'Österreich', '+43 0512 560303', 'ATU 61718733', '1', '1', '1', NULL, '1', NULL, NULL),
('2', 'Staatl. bef. u. beeideter Ziviltechniker', 'Herr', 'Christoph Falkner', 'Ziviltechniker Christoph Falkner', 'christophfalkner@me.com', 'Adele-Obermayr-Straße 2', 'Innsbruck', '6020', 'Österreich', '+43 650 92210248', 'ATU56874500', '1', '1', '1', NULL, '1', NULL, NULL);
('1', 'Architekt', 'Herr', 'Hanno Vogl-Fernheim', 'Architekt Vogl-Fernheim', 'office@vogl-fernheim.eu', 'Richardsweg 1', 'Innsbruck', '6020', 'Österreich', '+43 0512 560303', 'ATU 61718733', '1', '1', NULL, '1', NULL, NULL),
('2', 'Staatl. bef. u. beeideter Ziviltechniker', 'Herr', 'Christoph Falkner', 'Ziviltechniker Christoph Falkner', 'christophfalkner@me.com', 'Adele-Obermayr-Straße 2', 'Innsbruck', '6020', 'Österreich', '+43 650 92210248', 'ATU56874500', '1', '1', NULL, '1', NULL, NULL);
";
DB::unprepared($sql);
}
@@ -26,6 +26,7 @@ class RolesAndPermissionsSeeder extends Seeder
'name' => 'Hermann Telser',
'email' => 'ht@webwerkstatt.tirol',
'password' => Hash::make('salam'),
'agb_akzeptiert' => true,
'app_verified_at' => now(),
'email_verified_at' => now(),
]);
@@ -38,6 +39,7 @@ class RolesAndPermissionsSeeder extends Seeder
'name' => 'Yvonne Bormes',
'email' => 'yvonne.bormes@ztkammer.at',
'password' => Hash::make('yvonne'),
'agb_akzeptiert' => true,
'app_verified_at' => now(),
'email_verified_at' => now(),
]);
@@ -49,6 +51,7 @@ class RolesAndPermissionsSeeder extends Seeder
'name' => 'Daniela Mandlez',
'email' => 'daniela.mandkez@kammerwest.at',
'password' => Hash::make('daniela'),
'agb_akzeptiert' => true,
'app_verified_at' => now(),
'email_verified_at' => now(),
]);