#20 - wip
This commit is contained in:
23
database/factories/VacationRequestFactory.php
Normal file
23
database/factories/VacationRequestFactory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Toby\Enums\VacationType;
|
||||
use Toby\Models\User;
|
||||
|
||||
class VacationRequestFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
"user_id" => User::factory(),
|
||||
"type" => $this->faker->randomElement(VacationType::cases()),
|
||||
"from" => $this->faker->date,
|
||||
"to" => $this->faker->date,
|
||||
"comment" => $this->faker->boolean ? $this->faker->paragraph() : null,
|
||||
];
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create("personal_access_tokens", function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->morphs("tokenable");
|
||||
$table->string("name");
|
||||
$table->string("token", 64)->unique();
|
||||
$table->text("abilities")->nullable();
|
||||
$table->timestamp("last_used_at")->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists("personal_access_tokens");
|
||||
}
|
||||
};
|
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Toby\Models\User;
|
||||
|
||||
return new class() extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('vacation_requests', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignIdFor(User::class)->constrained()->cascadeOnDelete();
|
||||
$table->string("type");
|
||||
$table->date("from");
|
||||
$table->date("to");
|
||||
$table->text("comment")->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('vacation_requests');
|
||||
}
|
||||
};
|
@@ -28,7 +28,9 @@ class DatabaseSeeder extends Seeder
|
||||
User::factory(9)->create();
|
||||
User::factory([
|
||||
"email" => env("LOCAL_EMAIL_FOR_LOGIN_VIA_GOOGLE"),
|
||||
])->create();
|
||||
])
|
||||
->hasVacationRequests(5)
|
||||
->create();
|
||||
|
||||
$users = User::all();
|
||||
|
||||
|
Reference in New Issue
Block a user