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:
56
database/factories/TaskFactory.php
Normal file
56
database/factories/TaskFactory.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Task;
|
||||
use App\Models\TaskCollection;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TaskFactory extends Factory
|
||||
{
|
||||
protected $model = Task::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'tenant_id' => Tenant::factory(),
|
||||
'title' => $this->faker->sentence(4),
|
||||
'description' => $this->faker->paragraph(),
|
||||
'due_date' => $this->faker->dateTimeBetween('now', '+1 month'),
|
||||
'is_completed' => $this->faker->boolean(20), // 20% chance completed
|
||||
'collection_id' => null,
|
||||
];
|
||||
}
|
||||
|
||||
public function completed(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_completed' => true,
|
||||
'completed_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function urgent(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'priority' => 'urgent',
|
||||
'due_date' => $this->faker->dateTimeBetween('now', '+3 days'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function withCollection(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'collection_id' => TaskCollection::factory(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function assignedToEvent(): static
|
||||
{
|
||||
return $this->afterCreating(function (Task $task) {
|
||||
$event = \App\Models\Event::factory()->create(['tenant_id' => $task->tenant_id]);
|
||||
$task->assignedEvents()->attach($event);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user