47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\WorkingHour>
|
|
*/
|
|
class WorkingHourFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'day_of_week' => fake()->numberBetween(0, 6),
|
|
'start_time' => '09:00:00',
|
|
'end_time' => '17:00:00',
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Create working hours for weekdays (Sunday-Thursday, 0-4).
|
|
*/
|
|
public function weekdays(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'day_of_week' => fake()->numberBetween(0, 4),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Create inactive working hours.
|
|
*/
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => false,
|
|
]);
|
|
}
|
|
}
|