fix resources hospital

This commit is contained in:
Muhammad Fajar
2022-11-03 15:52:51 +07:00
parent 5f8515feac
commit 6a57b8179a
6 changed files with 62 additions and 75 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Modules\Linksehat\Transformers\Speciality;
use App\Helpers\Helper;
use Illuminate\Http\Resources\Json\JsonResource;
class SpecialityForHospitalDetailResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'name' => 'Spesialis ' . $this->name,
'avatar' => url('images/default-hospital-image.png'),
];
}
}

View File

@@ -36,7 +36,7 @@ class SpecialityResource extends JsonResource
'specialis' => 'Spesialis ' . (isset($this->speciality->name) ? $this->speciality->name : $this->speciality_name),
'experience' => rand(5, 12),
'rating' => rand(20, 100),
'price' => Helper::currencyIdrFormat($prices) ?? null,
'price' => $prices ? Helper::currencyIdrFormat($prices) : null,
]),
$this->mergeWhen($this->name, [
'title' => 'Spesialis ' . $this->name,