<?php

namespace App\Http\Resources\Roles;

use Illuminate\Http\Resources\Json\JsonResource;

class PermissionResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this->id ?? $this['id'] ?? 0),
            'name' => (string) ($this->name ?? $this['name'] ?? ''),
            'description' => $this->description ?? $this['description'] ?? null,
            'created_at' => $this->created_at ?? $this['created_at'] ?? null,
            'updated_at' => $this->updated_at ?? $this['updated_at'] ?? null,
        ];
    }
}
