feat: inisialisasi project kit v2
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class UserResource extends JsonResource
|
||||
{
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'firstName' => $this->first_name,
|
||||
'lastName' => $this->last_name,
|
||||
'fullName' => $this->getFullName(),
|
||||
'email' => $this->email,
|
||||
'phone' => $this->phone,
|
||||
'bio' => $this->bio,
|
||||
'status' => $this->status,
|
||||
'avatarUrl' => $this->avatar_url,
|
||||
'roles' => $this->getRoleNames(),
|
||||
'permissions' => $this->getAllPermissions()->pluck('name'),
|
||||
'createdAt' => $this->created_at,
|
||||
'updatedAt' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user