mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-05-07 20:32:26 +00:00
38 lines
865 B
PHP
38 lines
865 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Role;
|
|
use App\Models\Organization;
|
|
use App\Models\OrganizationInvitation;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<OrganizationInvitation>
|
|
*/
|
|
class OrganizationInvitationFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'email' => $this->faker->unique()->safeEmail(),
|
|
'role' => Role::Employee->value,
|
|
'organization_id' => Organization::factory(),
|
|
];
|
|
}
|
|
|
|
public function forOrganization(Organization $organization): self
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'organization_id' => $organization->getKey(),
|
|
]);
|
|
}
|
|
}
|