33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Database\Factories;
|
||
|
|
|
||
|
|
use App\Models\Todo;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
|
use Illuminate\Support\Str;
|
||
|
|
|
||
|
|
class TodoFactory extends Factory
|
||
|
|
{
|
||
|
|
protected $model = Todo::class;
|
||
|
|
|
||
|
|
public function definition(): array
|
||
|
|
{
|
||
|
|
$now = $this->faker->dateTimeBetween('-1 month', 'now');
|
||
|
|
return [
|
||
|
|
'id' => (string) Str::uuid(),
|
||
|
|
'etag' => null,
|
||
|
|
'title' => $this->faker->sentence(4),
|
||
|
|
'description' => $this->faker->optional()->paragraph(),
|
||
|
|
'type_id' => null,
|
||
|
|
'url' => $this->faker->optional()->url(),
|
||
|
|
'due_date' => $this->faker->optional()->dateTimeBetween('now', '+2 months'),
|
||
|
|
'recurring' => $this->faker->optional()->regexify('RRULE:FREQ=DAILY;COUNT=\d{1,2}'),
|
||
|
|
'priority' => $this->faker->optional()->numberBetween(1, 9),
|
||
|
|
'status' => $this->faker->randomElement(['NEEDS-ACTION','IN-PROCESS','COMPLETED', null]),
|
||
|
|
'created_at' => $now,
|
||
|
|
'last_modified' => $this->faker->dateTimeBetween($now, 'now'),
|
||
|
|
'parent' => null,
|
||
|
|
'object' => null,
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|