26 lines
912 B
PHP
26 lines
912 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
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 [
|
|
'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,
|
|
];
|
|
}
|
|
}
|