mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 20:24:44 +02:00

* remove `guard_name` from api and add id to transformer * disallow update/ delete for root admin role via api * disallow assigning root admin via api * add api to remove user roles * fix assignRoles & removeRoles
23 lines
503 B
PHP
23 lines
503 B
PHP
<?php
|
|
|
|
namespace App\Transformers\Api\Application;
|
|
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
class RolePermissionTransformer extends BaseTransformer
|
|
{
|
|
public function getResourceName(): string
|
|
{
|
|
return 'permissions';
|
|
}
|
|
|
|
public function transform(Permission $model): array
|
|
{
|
|
return [
|
|
'name' => $model->name,
|
|
'created_at' => $model->created_at->toAtomString(),
|
|
'updated_at' => $model->updated_at->toAtomString(),
|
|
];
|
|
}
|
|
}
|