Implement multi-tenancy support with OAuth2 authentication for tenant admins, Stripe integration for event purchases and credits ledger, new Filament resources for event purchases, updated API routes and middleware for tenant isolation and token guarding, added factories/seeders/migrations for new models (Tenant, EventPurchase, OAuth entities, etc.), enhanced tests, and documentation updates. Removed outdated DemoAchievementsSeeder.
This commit is contained in:
66
database/factories/TenantFactory.php
Normal file
66
database/factories/TenantFactory.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?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);
|
||||
|
||||
return [
|
||||
'name' => $name,
|
||||
'slug' => $slug,
|
||||
'contact_email' => $this->faker->companyEmail(),
|
||||
'event_credits_balance' => $this->faker->numberBetween(1, 20),
|
||||
'subscription_tier' => $this->faker->randomElement(['free', 'starter', 'pro']),
|
||||
'subscription_expires_at' => $this->faker->dateTimeBetween('now', '+1 year'),
|
||||
'is_active' => true,
|
||||
'is_suspended' => false,
|
||||
'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,
|
||||
]),
|
||||
'settings_updated_at' => now(),
|
||||
];
|
||||
}
|
||||
|
||||
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) => [
|
||||
'event_credits_balance' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user