lernschiff/database/factories/LicenseFactory.php

42 lines
859 B
PHP

<?php
namespace Database\Factories;
use App\Models\Tenant;
use Illuminate\Database\Eloquent\Factories\Factory;
class LicenseFactory extends Factory
{
public function definition(): array
{
return [
'tenant_id' => Tenant::factory(),
'type' => 'per_student',
'seats' => 30,
'expires_at' => now()->addYear(),
'active' => true,
];
}
public function active(): static
{
return $this->state([
'active' => true,
'expires_at' => now()->addYear(),
]);
}
public function expired(): static
{
return $this->state([
'active' => true,
'expires_at' => now()->subDay(),
]);
}
public function inactive(): static
{
return $this->state(['active' => false]);
}
}