api get person/doctor by speciality

This commit is contained in:
Muhammad Fajar
2022-10-28 15:03:21 +07:00
parent 03fdf2684d
commit e025675210
4 changed files with 59 additions and 17 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace Modules\Linksehat\Transformers\Speciality;
use App\Models\Practice;
use Illuminate\Http\Resources\Json\JsonResource;
class SpecialityResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'doctors' => [
'name' => $this->practitioner->person->name,
'specialis' => 'Spesialis ' . $this->speciality->name,
'experience' => rand(5, 12),
'rating' => rand(20, 100),
'price' => '',
]
];
}
}