31 lines
692 B
PHP
31 lines
692 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Task>
|
|
*/
|
|
class TaskFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'title' => $this->faker->sentence(3),
|
|
'is_done' => $this->faker->boolean(30),
|
|
'due_at' => $this->faker->optional()->dateTimeBetween('-1 month', '+1 month'),
|
|
];
|
|
}
|
|
|
|
public function done(): self
|
|
{
|
|
return $this->state(fn() => ['is_done' => true]);
|
|
}
|
|
}
|