23 lines
735 B
PHP
23 lines
735 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Roles;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RolePermissionResource extends JsonResource
|
|
{
|
|
public function toArray($request): array
|
|
{
|
|
return [
|
|
'permission_id' => (int) ($this['id'] ?? $this['permission_id'] ?? 0),
|
|
'name' => (string) ($this['name'] ?? ''),
|
|
'description' => $this['description'] ?? null,
|
|
'can_create' => (int) ($this['can_create'] ?? 0),
|
|
'can_read' => (int) ($this['can_read'] ?? 0),
|
|
'can_update' => (int) ($this['can_update'] ?? 0),
|
|
'can_delete' => (int) ($this['can_delete'] ?? 0),
|
|
'can_manage' => (int) ($this['can_manage'] ?? 0),
|
|
];
|
|
}
|
|
}
|