Creating a role transformer

parent f21f52e2
<?php
namespace Modules\User\Transformers;
use Illuminate\Http\Resources\Json\Resource;
class RoleTransformer extends Resource
{
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'slug' => $this->slug,
'created_at' => $this->created_at,
'urls' => [
'delete_url' => route('api.user.role.destroy', $this->id),
],
];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment