clupilot/app/database/factories/CronFactory.php

29 lines
991 B
PHP

<?php
namespace Database\Factories;
use App\Models\Workspace;
use App\Models\Cron;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
class CronFactory extends Factory
{
protected $model = Cron::class;
public function definition(): array
{
return [
'workspace_id' => Workspace::factory(),
'site_id' => Site::factory(),
'name' => $this->faker->randomElement(['Backup nightly', 'Cache flush', 'WP cron', 'Sitemap rebuild']),
'expression' => $this->faker->randomElement(['0 * * * *', '*/15 * * * *', '0 2 * * *', '*/5 * * * *']),
'command' => 'php /var/www/html/artisan ' . $this->faker->randomElement(['queue:work', 'cache:clear', 'schedule:run']),
'last_run_at' => $this->faker->dateTimeBetween('-1 hour', 'now'),
'status' => $this->faker->randomElement(['ok', 'ok', 'ok', 'failing']),
'enabled' => true,
];
}
}