![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/Corals/modules/RentPix/Transformers/ |
<?php namespace Corals\Modules\RentPix\Transformers; use Corals\Foundation\Transformers\BaseTransformer; use Corals\Modules\RentPix\Models\Reservation; class ReservationTransformer extends BaseTransformer { public function __construct($extras = []) { $this->resource_url = config('rentPix.models.reservation.resource_url'); parent::__construct($extras); } /** * @param Reservation $reservation * @return array * * @throws \Throwable */ public function transform(Reservation $reservation) { $show_url = $reservation->getShowURL(); $transformedArray = [ 'id' => $reservation->id, 'code' => HtmlElement('a', [ 'href' => url('reservation-details?code=' . $reservation->code . '&signature=' . md5($reservation->code . '|' . $reservation->integration_id)), 'target' => '_blank', ], sprintf('%s %s', $reservation->code, '<i class="fa fa-external-link" aria-hidden="true"></i>') ), 'code_without_link' => $reservation->code, 'type' => formatStatusAsLabels($reservation->type, ['level' => 'info']), 'rental_status' => formatStatusAsLabels($reservation->rental_status, ['level' => 'success']), 'unit' => optional($reservation->unit)->present('code_without_link') ?? '-', 'customer' => optional($reservation->customer)->presentStripTags('name') ?? '-', 'start_location' => $reservation->start_location, 'end_location' => $reservation->end_location, 'starts_at' => format_date_time($reservation->starts_at), 'ends_at' => format_date_time($reservation->ends_at), 'created_at' => format_date($reservation->created_at), 'updated_at' => format_date($reservation->updated_at), 'action' => $this->actions($reservation), ]; return parent::transformResponse($transformedArray); } }