Edit File: StoreProfileResource.php
<?php namespace App\Http\Resources; use App\Models\Category; use App\Models\Setting; use App\Services\SettingService; use Illuminate\Http\Resources\Json\JsonResource; class StoreProfileResource extends JsonResource { public function toArray($request) { $lang = $request->header('lang') ?? 'ar'; $setting = SettingService::appInformations(Setting::pluck('value', 'key')); $category = Category::where('slug', $this->category)->first(); return [ 'id' => $this->id, 'category_name' => $category ? $category->name : '', 'is_open' => $this->openingHours($lang)['open_status'], 'view_in_ui_only' => $setting['view_in_ui_only'] == 'false' ? false : true, 'name_ar' => $this->getTranslation('name', 'ar'), 'name_en' => $this->getTranslation('name', 'en'), 'desc_en' => $this->getTranslation('desc', 'en'), 'desc_ar' => $this->getTranslation('desc', 'ar'), 'name' => $this->name, 'desc' => $this->desc, 'icon' => $this->icon ? $this->iconPath : '', 'cover' => $this->cover ? $this->coverPath : '', 'lat' => (string) $this->lat ?? '', 'long' => (string) $this->long ?? '', 'address' => $this->address ?? '', 'num_rating' => $this->num_rating ?? 0, 'rate' => $this->rate ? number_format($this->rate, 1) : '0.0', 'rate_num' => (string) $this->num_rating ?? '0', 'category' => $this->category ?? '', 'iban_number' => $this->iban_number ?? '', 'bank_number' => $this->bank_number ?? '', 'bank_name' => $this->bank_name ?? '', 'commercial_id' => $this->commercial_id ?? '', 'commercial_image' => $this->CommercialImagePath ?? '', 'offer' => $this->offer == 'true' ? true : false, 'offer_image' => $this->offer_image ? $this->offerPath : '', 'offer_amount' => (string) $this->offer_amount ?? '0', 'offer_type' => (string) $this->offer_type ?? '', 'offer_max' => (string) $this->offer_max ?? '', 'available' => (string) $this->available == 'true' ? true : false, 'has_contract' => ((string) $this->has_contract == 'true' || (string) $this->has_contract == '1') ? true : false, 'commission_used' => $this->commission_used , 'distance' => (number_format((float) $this->distance, 2, '.', '') ?? '0.00') . ' ' . trans('stores.km'), 'opening_hours' => $this->storeOpeningHours(), 'branch_country_key' => $this->user->country_key, 'branch_phone' => $this->user->phone, 'branch_email' => $this->user->email, 'new_orders_notify' => $this->user->new_orders_notify == 'true' ? true : false, ]; } }
Back to File Manager