add role permission logic
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?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),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user