49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\BlockedTime>
|
|
*/
|
|
class BlockedTimeFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'block_date' => fake()->dateTimeBetween('now', '+30 days'),
|
|
'start_time' => null,
|
|
'end_time' => null,
|
|
'reason' => fake()->optional()->sentence(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Create a full day block.
|
|
*/
|
|
public function fullDay(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'start_time' => null,
|
|
'end_time' => null,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Create a partial day block with specific times.
|
|
*/
|
|
public function partialDay(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'start_time' => '09:00:00',
|
|
'end_time' => '12:00:00',
|
|
]);
|
|
}
|
|
}
|