33 lines
906 B
PHP
33 lines
906 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Resources\Json\Resource;
|
|
|
|
class PermissionResource extends Resource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'data' => [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'guard_name' => $this->guard_name,
|
|
'created_at' => $this->created_at->toIso8601String(),
|
|
'updated_at' => $this->updated_at->toIso8601String(),
|
|
'deleted_at' => $this->deleted_at
|
|
? $this->deleted_at->toIso8601String()
|
|
: $this->deleted_at,
|
|
'roles' => $this->roles,
|
|
'users' => $this->users,
|
|
]
|
|
];
|
|
}
|
|
}
|