59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\CardPin\Requests;
|
|
|
|
use App\Repos\Order\OrderRepo;
|
|
use App\Repos\System\Settings\Location\RegionRepo;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
/**
|
|
* @mixin \App\Models\Order\Card\CardPin\CardPin
|
|
*/
|
|
class CardPinIndexResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'unique_id' => $this->unique_id,
|
|
|
|
'card_type_id' => $this->cardType?->name,
|
|
|
|
'card_number' => $this->card_number,
|
|
|
|
'region' => RegionRepo::label($this->region),
|
|
'branch_id' => $this->branch?->name,
|
|
|
|
'customer_name' => $this->customer_name,
|
|
'customer_surname' => $this->customer_surname,
|
|
'customer_patronic_name' => $this->customer_patronic_name,
|
|
'born_at' => $this->born_at,
|
|
|
|
'phone' => $this->phone,
|
|
|
|
'status' => OrderRepo::statusFormatted($this->status),
|
|
|
|
'passport_serie' => $this->passport_serie,
|
|
'passport_id' => $this->passport_id,
|
|
'passport_one' => url('/storage/'.$this->passport_one),
|
|
'passport_two' => url('/storage/'.$this->passport_two),
|
|
'passport_three' => url('/storage/'.$this->passport_three),
|
|
'passport_four' => url('/storage/'.$this->passport_four),
|
|
|
|
'notes' => $this->notes,
|
|
|
|
'user_id' => $this->user_id,
|
|
|
|
'created_at' => $this->created_at,
|
|
'updated_at' => $this->updated_at,
|
|
'deleted_at' => $this->deleted_at,
|
|
];
|
|
}
|
|
}
|