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:
63
database/factories/EventFactory.php
Normal file
63
database/factories/EventFactory.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class EventFactory extends Factory
|
||||
{
|
||||
protected $model = Event::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$name = $this->faker->words(3, true);
|
||||
$slug = Str::slug($name);
|
||||
|
||||
return [
|
||||
'tenant_id' => Tenant::factory(),
|
||||
'name' => $name,
|
||||
'slug' => $slug,
|
||||
'description' => $this->faker->paragraph(),
|
||||
'date' => $this->faker->dateTimeBetween('now', '+6 months'),
|
||||
'location' => $this->faker->address(),
|
||||
'max_participants' => $this->faker->numberBetween(50, 500),
|
||||
'is_active' => true,
|
||||
'join_link_enabled' => true,
|
||||
'photo_upload_enabled' => true,
|
||||
'task_checklist_enabled' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_active' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function withTasks(int $count = 3): static
|
||||
{
|
||||
return $this->afterCreating(function (Event $event) use ($count) {
|
||||
$event->tasks()->attach(
|
||||
\App\Models\Task::factory($count)->create(['tenant_id' => $event->tenant_id])
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public function past(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'date' => $this->faker->dateTimeBetween('-1 month', 'now'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function upcoming(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'date' => $this->faker->dateTimeBetween('now', '+1 month'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user