| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace App\Http\Resources;
- use Carbon\Carbon;
- use Illuminate\Http\Request;
- use Illuminate\Http\Resources\Json\JsonResource;
- use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
- use App\Models\SupportTicket;
- class SupportTicketResource extends JsonResource
- {
- public function toArray(Request $request): array
- {
- return [
- 'id' => $this->id,
- 'title' => $this->title,
- 'description' => $this->description,
- 'severity' => $this->severity,
- 'scope' => $this->scope,
- 'unit_id' => $this->unit_id,
- 'sector' => $this->sector,
- 'status' => $this->status,
- 'applicant_user_id' => $this->applicant_user_id,
- 'responsable_user_id' => $this->responsable_user_id,
- 'created_at' => Carbon::parse($this->created_at)->format('d/m/Y H:i'),
- 'updated_at' => Carbon::parse($this->updated_at)->format('d/m/Y H:i'),
- ];
- }
- /**
- * @param \Illuminate\Database\Eloquent\Collection<SupportTicket> $resource
- * @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection<SupportTicketResource>
- */
- public static function collection($resource): AnonymousResourceCollection
- {
- return parent::collection($resource);
- }
- }
|