Edit File: ProviderResource.php
<?php namespace App\Http\Resources\Api\Provider; use App\Http\Resources\Api\BasicResource; use App\Models\Country; use Illuminate\Http\Resources\Json\JsonResource; class ProviderResource extends JsonResource { private $token = ''; public function setToken($value) { $this->token = $value; return $this; } public function toArray($request) { return [ 'id' => $this?->id, 'image' => $this?->image, 'logo' => $this?->logo, 'name' => $this?->name, 'identity_number' => $this?->identity_number, 'tax_number' => $this?->tax_number, 'civil_registration_number' => $this?->civil_registration_number, $this?->attributes('store_name'), $this?->attributes('store_description'), 'whatsapp_country_code' => $this?->whatsapp_country_code, 'whatsapp_phone' => $this?->whatsapp_phone, 'city' => new BasicResource($this->city), 'location' => [ 'lat' => $this?->lat, 'lng' => $this?->lng, 'map_desc' => $this?->map_desc ], 'neighborhood' => new BasicResource($this->neighborhood), 'minimum_order' => $this?->minimum_order, 'bank_info' => new BankAccountResource($this->bankAccount), // start categories 'main_category' => new BasicResource($this->mainCategory), 'categories' => BasicResource::collection($this->subCategories), // end categories 'is_receive_orders_in_location' => $this?->is_receive_orders_in_location, 'is_available_to_recieve_orders' => $this?->is_available_to_recieve_orders, 'delivery_method' => $this?->delivery_method_text, 'email' => $this?->email, 'country_code' => $this?->country_code, 'phone' => $this?->phone, 'full_phone' => $this?->full_phone, 'country_flag' => Country::where('key', 'like', '%' . $this->country_code . '%')->first()?->flag, 'lang' => $this?->lang, 'is_notify' => (bool)$this?->is_notify, 'map_desc' => $this?->map_desc, 'number_of_un_pricing_orders' => $this?->negotiationOrders()?->count(), 'preparing_time' => $this?->preparing_time, 'token' => $this->when($this->token, $this->token), ]; } }
Back to File Manager