34 lines
960 B
PHP
34 lines
960 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources\Admin;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class UserResource extends JsonResource
|
|
{
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'full_name' => $this->full_name,
|
|
'username' => $this->username,
|
|
'gender' => $this->gender,
|
|
'email' => $this->email,
|
|
'phone_number' => $this->phone_number,
|
|
'avatar' => $this->avatar,
|
|
'national_id' => $this->national_id,
|
|
'position' => $this->position,
|
|
'province_id' => $this->province_id,
|
|
'province_name' => $this->province_name,
|
|
'role' => $this->roles->pluck('id', 'name_fa'),
|
|
'permissions' => $this->getPermissionNames(),
|
|
'telephone_id' => $this->telephone_id
|
|
];
|
|
}
|
|
}
|