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:
46
database/factories/TaskCollectionFactory.php
Normal file
46
database/factories/TaskCollectionFactory.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\TaskCollection;
|
||||
use App\Models\Tenant;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class TaskCollectionFactory extends Factory
|
||||
{
|
||||
protected $model = TaskCollection::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$categories = ['Allgemein', 'Vorbereitung', 'Event-Tag', 'Aufräumen', 'Follow-up'];
|
||||
$colors = ['#3B82F6', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6'];
|
||||
|
||||
return [
|
||||
'tenant_id' => Tenant::factory(),
|
||||
'name' => $this->faker->randomElement($categories),
|
||||
'description' => $this->faker->sentence(),
|
||||
'is_default' => $this->faker->boolean(20),
|
||||
'position' => $this->faker->numberBetween(1, 10),
|
||||
];
|
||||
}
|
||||
|
||||
public function withTasks(int $count = 3): static
|
||||
{
|
||||
return $this->afterCreating(function (TaskCollection $collection) use ($count) {
|
||||
\App\Models\Task::factory($count)
|
||||
->create(['tenant_id' => $collection->tenant_id])
|
||||
->each(function ($task) use ($collection) {
|
||||
$task->taskCollection()->associate($collection);
|
||||
$task->save();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public function default(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_default' => true,
|
||||
'position' => 1,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user