2025-10-11 23:02:54 +02:00
|
|
|
<?php
|
2026-01-23 15:09:50 +01:00
|
|
|
|
2025-10-11 23:02:54 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
|
|
use FireflyIII\Enums\AccountTypeEnum;
|
|
|
|
|
use FireflyIII\Models\AccountType;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
|
|
class AccountFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
public function definition(): array
|
|
|
|
|
{
|
2026-01-23 15:09:50 +01:00
|
|
|
return ['name' => $this->faker->name(), 'active' => true];
|
2025-10-11 23:02:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function withType(AccountTypeEnum $type): static
|
|
|
|
|
{
|
|
|
|
|
return $this->for(AccountType::where('type', $type->value)->first());
|
|
|
|
|
}
|
|
|
|
|
}
|