completed story 1.1 with QA tests and fixes
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user