Files
fotospiel-app/database/factories/TenantFactory.php

67 lines
1.9 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Tenant;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class TenantFactory extends Factory
{
protected $model = Tenant::class;
public function definition(): array
{
$name = $this->faker->company();
$slug = Str::slug($name);
$contactEmail = $this->faker->companyEmail();
return [
'name' => $name,
'slug' => $slug,
'contact_email' => $contactEmail,
'subscription_tier' => $this->faker->randomElement(['free', 'starter', 'pro']),
'subscription_expires_at' => $this->faker->dateTimeBetween('now', '+1 year'),
'is_active' => true,
'is_suspended' => false,
'settings_updated_at' => now(),
'settings' => json_encode([
'branding' => [
'logo_url' => null,
'primary_color' => '#3B82F6',
'secondary_color' => '#1F2937',
'font_family' => 'Inter, sans-serif',
],
'features' => [
'photo_likes_enabled' => true,
'event_checklist' => true,
'custom_domain' => false,
'advanced_analytics' => false,
],
'custom_domain' => null,
'contact_email' => $contactEmail,
'event_default_type' => 'general',
]),
];
}
public function suspended(): static
{
return $this->state(fn (array $attributes) => [
'is_suspended' => true,
]);
}
public function inactive(): static
{
return $this->state(fn (array $attributes) => [
'is_active' => false,
]);
}
public function withLowCredits(): static
{
return $this->state(fn (array $attributes) => $attributes);
}
}