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:
42
app/Http/Resources/Tenant/TaskResource.php
Normal file
42
app/Http/Resources/Tenant/TaskResource.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources\Tenant;
|
||||
|
||||
use App\Http\Resources\Tenant\EventResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class TaskResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'priority' => $this->priority,
|
||||
'due_date' => $this->due_date?->toISOString(),
|
||||
'is_completed' => $this->is_completed,
|
||||
'collection_id' => $this->collection_id,
|
||||
'assigned_events_count' => $this->assignedEvents()->count(),
|
||||
// TaskCollectionResource wird später implementiert
|
||||
// 'collection' => $this->whenLoaded('taskCollection', function () {
|
||||
// return new TaskCollectionResource($this->taskCollection);
|
||||
// }),
|
||||
'assigned_events' => $this->whenLoaded('assignedEvents', function () {
|
||||
return EventResource::collection($this->assignedEvents);
|
||||
}),
|
||||
// UserResource wird später implementiert
|
||||
// 'assigned_to' => $this->whenLoaded('assignedTo', function () {
|
||||
// return new UserResource($this->assignedTo);
|
||||
// }),
|
||||
'created_at' => $this->created_at->toISOString(),
|
||||
'updated_at' => $this->updated_at->toISOString(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user