faker
This commit is contained in:
1 parent
11cb9b03f5
commit
5f95289079
25 files changed
+430
-129
No files matched your search
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Gutachter>
|
||||
*/
|
||||
class GutachterFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'konto_id' => fake()->numberBetween(1, 7),
|
||||
'name' => fake()->name(),
|
||||
'address' => fake()->Address(),
|
||||
'country' => 'Österreich',
|
||||
'phone' => fake()->PhoneNumber(),
|
||||
'email' => fake()->email(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Konto>
|
||||
*/
|
||||
class KontoFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'title' => fake()->randomElement(['Architekt:in', 'Ziviltechniker:in']),
|
||||
'gender' => fake()->randomElement(['Frau', 'Herr']),
|
||||
'first_name' => fake()->firstName(),
|
||||
'last_name' => fake()->lastName(),
|
||||
'company' => fake()->Company(),
|
||||
'email' => fake()->email(),
|
||||
'address' => fake()->Address(),
|
||||
'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'),
|
||||
'abgeschlossen' => fake()->numberBetween(4, 150),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -13,23 +13,21 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('kontos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('konto_title')->nullable();
|
||||
$table->string('konto_gender')->nullable();
|
||||
$table->string('konto_first_name');
|
||||
$table->string('konto_last_name');
|
||||
$table->string('konto_company');
|
||||
$table->string('konto_email')->nullable();
|
||||
$table->string('konto_address')->nullable();
|
||||
$table->string('konto_location')->nullable();
|
||||
$table->string('konto_plz')->nullable();
|
||||
$table->string('konto_country')->nullable();
|
||||
$table->string('konto_phone')->nullable();
|
||||
$table->string('konto_uid_number')->nullable();
|
||||
$table->boolean('konto_agb_akzeptiert')->default(false);
|
||||
$table->string('konto_option_id')->default(1);
|
||||
$table->string('konto_gutachten_zahl')->default(0);
|
||||
$table->timestamp('konto_gutachten_zeit')->nullable();
|
||||
$table->string('konto_gutachten_abgeschlossen')->default(1);
|
||||
$table->string('title')->nullable();
|
||||
$table->string('gender')->nullable();
|
||||
$table->string('first_name');
|
||||
$table->string('last_name');
|
||||
$table->string('company');
|
||||
$table->string('email')->nullable();
|
||||
$table->string('address')->nullable();
|
||||
$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();
|
||||
$table->string('abgeschlossen')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ return new class extends Migration
|
||||
{
|
||||
Schema::create('gutachters', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('konto_id');
|
||||
$table->foreignId('konto_id')->constrained();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('logo')->nullable();
|
||||
$table->string('address')->nullable();
|
||||
$table->string('location')->nullable();
|
||||
$table->string('code')->nullable();
|
||||
$table->string('country')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->timestamp('deleted_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
+2
-2
@@ -11,13 +11,13 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('konto_options', function (Blueprint $table) {
|
||||
Schema::create('plans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->integer('number_user')->default(1);
|
||||
$table->integer('number_gutachter')->default(1);
|
||||
$table->integer('payment_plan_id')->default(1);
|
||||
$table->integer('payment_id')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
+2
-2
@@ -11,7 +11,7 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('payment_plans', function (Blueprint $table) {
|
||||
Schema::create('payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
@@ -24,6 +24,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_plans');
|
||||
Schema::dropIfExists('payments');
|
||||
}
|
||||
};
|
||||
@@ -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::create('titels', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('titels');
|
||||
}
|
||||
};
|
||||
@@ -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::create('genders', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('genders');
|
||||
}
|
||||
};
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Gutachter;
|
||||
use App\Models\Konto;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
@@ -11,11 +13,15 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
KontoSeeder::class,
|
||||
RolesAndPermissionsSeeder::class,
|
||||
KontoOptionSeeder::class,
|
||||
OrientierungenSeeder::class,
|
||||
]);
|
||||
Konto::factory()->count(10)->create();
|
||||
|
||||
// Gutachter::factory()->create(30);
|
||||
|
||||
// $this->call([
|
||||
// OrientierungenSeeder::class,
|
||||
// KontoOptionSeeder::class,
|
||||
// RolesAndPermissionsSeeder::class,
|
||||
// ]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ class KontoOptionSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$sql = "INSERT INTO `payment_plans` (`id`, `name`)
|
||||
$sql = "INSERT INTO `payments` (`id`, `name`)
|
||||
VALUES
|
||||
('1', 'Pro Gutachten'),
|
||||
('2', 'Monatlich'),
|
||||
@@ -20,7 +20,7 @@ class KontoOptionSeeder extends Seeder
|
||||
";
|
||||
DB::unprepared($sql);
|
||||
|
||||
$sql = "INSERT INTO `konto_options` (`id`, `name`, `description`, `number_user`, `number_gutachter`, `payment_plan_id`, `created_at`, `updated_at`)
|
||||
$sql = "INSERT INTO `plans` (`id`, `name`, `description`, `number_user`, `number_gutachter`, `payment_id`, `created_at`, `updated_at`)
|
||||
VALUES
|
||||
('1', 'Basic', 'Basis Version für einen Benutzer und einem Gutacher.', '1', '1', '1', NULL, NULL),
|
||||
('2', 'Erweitert', 'Premium Version für 3 Benutzer und 3 Gutacher.', '3', '3', '2', NULL, NULL),
|
||||
|
||||
Reference in new issue
Block a user