card orders done

This commit is contained in:
2025-06-11 18:05:30 +05:00
parent 10361e9422
commit 5dfce35a84
10 changed files with 522 additions and 10 deletions

View File

@@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers\Api\CardOrder\Resources;
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\CardOrder
*/
class CardOrderIndexResource 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,
'paid' => $this->paid,
'card_state_id' => $this->cardState?->name,
'card_type_id' => $this->cardType?->name,
'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,
'old_surname' => $this->old_surname,
'born_at' => $this->born_at,
'passport_serie' => $this->passport_serie,
'passport_id' => $this->passport_id,
'passport_given_at' => $this->passport_given_at,
'passport_given_by' => $this->passport_given_by,
'born_place' => $this->born_place,
'passport_address' => $this->passport_address,
'real_address' => $this->real_address,
'job_location' => $this->job_location,
'phone' => $this->phone,
'phone_additional' => $this->phone_additional,
'status' => OrderRepo::statusFormatted($this->status),
'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,
];
}
}