45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Application;
|
|
use App\Models\Position;
|
|
use App\Models\PusatMengundi;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends Factory<Application>
|
|
*/
|
|
class ApplicationFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$pusat = PusatMengundi::factory()->create();
|
|
$position = Position::factory()->create([
|
|
'is_public_applyable' => true,
|
|
]);
|
|
|
|
return [
|
|
'election_id' => $pusat->election_id,
|
|
'pusat_mengundi_id' => $pusat->id,
|
|
'public_uuid' => (string) Str::uuid(),
|
|
'source' => 'public',
|
|
'status' => 'submitted',
|
|
'name' => fake()->name(),
|
|
'ic_number' => fake()->unique()->numerify('############'),
|
|
'phone_number' => fake()->numerify('01########'),
|
|
'email' => fake()->safeEmail(),
|
|
'address' => fake()->address(),
|
|
'requested_position_id' => $position->id,
|
|
'bank_name' => 'Maybank',
|
|
'bank_account_number' => fake()->numerify('############'),
|
|
];
|
|
}
|
|
}
|