xNightR00T File Manager

Loading...
Current Directory:
Name Size Permission Modified Actions
Loading...
$ Waiting for command...
Addon.php000064400000000301152413172730006301 0ustar00belongsTo(User::class); } public function country() { return $this->belongsTo(Country::class); } public function state() { return $this->belongsTo(State::class); } public function city() { return $this->belongsTo(City::class); } public function area() { return $this->belongsTo(Area::class); } } AffiliateConfig.php000064400000000313152413172730010271 0ustar00belongsTo(User::class); } } AffiliateLog.php000064400000000740152413172730007611 0ustar00belongsTo(User::class); } public function order_detail() { return $this->belongsTo(OrderDetail::class); } public function order() { return $this->belongsTo(Order::class); } } AffiliateOption.php000064400000000313152413172730010334 0ustar00belongsTo(User::class); } public function affiliate_payments() { return $this->hasMany(AffiliatePayment::class)->orderBy('created_at', 'desc')->paginate(12); } } AffiliateWithdrawRequest.php000064400000000434152413172730012232 0ustar00belongsTo(User::class); } } AppSettings.php000064400000000440152413172730007521 0ustar00belongsTo(Currency::class); } } AppTranslation.php000064400000000457152413172730010227 0ustar00hasMany(AreaTranslation::class)->where('lang', $lang)->first(); return $area_translation != null ? $area_translation->$field : $this->$field; } public function area_translations(){ return $this->hasMany(AreaTranslation::class); } public function city() { return $this->belongsTo(City::class); } public function state() { return $this->belongsTo(State::class); } public function country() { return $this->belongsTo(Country::class); } } AreaTranslation.php000064400000000463152413172730010354 0ustar00belongsTo(Area::class); } } Attribute.php000064400000001430152413172730007223 0ustar00attribute_translations->where('lang', $lang)->first(); return $attribute_translation != null ? $attribute_translation->$field : $this->$field; } public function attribute_translations(){ return $this->hasMany(AttributeTranslation::class); } public function attribute_values() { return $this->hasMany(AttributeValue::class); } } AttributeCategory.php000064400000000375152413172730010730 0ustar00belongsTo(Attribute::class); } } AttributeValue.php000064400000000442152413172730010222 0ustar00belongsTo(Attribute::class); } } AuctionProductBid.php000064400000000572152413172730010650 0ustar00belongsTo(Product::class); } public function user() { return $this->belongsTo(User::class); } } Banner.php000064400000000302152413172730006462 0ustar00belongsTo(BlogCategory::class, 'category_id'); } } BlogCategory.php000064400000000543152413172730007645 0ustar00hasMany(Blog::class); } } Brand.php000064400000001537152413172730006316 0ustar00brand_translations->where('lang', $lang)->first(); return $brand_translation != null ? $brand_translation->$field : $this->$field; } public function brand_translations() { return $this->hasMany(BrandTranslation::class); } public function products() { return $this->hasMany(Product::class); } } BrandsImport.php000064400000002722152413172730007671 0ustar00 $row['name'], 'logo' => $this->downloadLogo($row['logo']), 'slug' => preg_replace('/[^A-Za-z0-9\-]/', '', str_replace(' ', '-', $row['name'])).'-'.Str::random(5), 'meta_title' => $row['meta_title'], 'meta_description' => $row['meta_description'], ]); } flash(translate('Brands imported successfully'))->success(); } public function model(array $row) { ++$this->rows; } public function downloadLogo($url) { try { $upload = new Upload; $upload->external_link = $url; $upload->type = 'image'; $upload->save(); return $upload->id; } catch (\Exception $e) { } return null; } } BrandTranslation.php000064400000000510152413172730010523 0ustar00belongsTo(Brand::class); } } BusinessSetting.php000064400000000313152413172730010410 0ustar00hasMany(CarrierRange::class); } public function carrier_range_prices(){ return $this->hasMany(CarrierRangePrice::class); } public function scopeActive($query) { return $query->where('status', 1); } } CarrierRange.php000064400000000720152413172730007625 0ustar00belongsTo(Carrier::class); } public function carrier_range_prices(){ return $this->hasMany(CarrierRangePrice::class); } } CarrierRangePrice.php000064400000001060152413172730010606 0ustar00belongsTo(Carrier::class); } public function carrier_ranges() { return $this->belongsTo(CarrierRange::class); } public function zone() { return $this->belongsTo(Zone::class); } } Cart.php000064400000001421152413172730006151 0ustar00belongsTo(User::class); } public function product() { return $this->belongsTo(Product::class); } public function address() { return $this->belongsTo(Address::class); } public function scopeActive($query) { return $query->where('status', 1); } } CartProduct.php000064400000000476152413172730007523 0ustar00belongsTo(Product::class); } } Category.php000064400000004702152413172730007042 0ustar00category_translations->where('lang', $lang)->first(); return $category_translation != null ? $category_translation->$field : $this->$field; } public function category_translations() { return $this->hasMany(CategoryTranslation::class); } public function coverImage() { return $this->belongsTo(Upload::class, 'cover_image'); } public function catIcon() { return $this->belongsTo(Upload::class, 'icon'); } public function products() { return $this->belongsToMany(Product::class, 'product_categories'); } public function preorderProducts() { return $this->belongsToMany(PreorderProduct::class, 'preorder_product_categories'); } public function bannerImage() { return $this->belongsTo(Upload::class, 'banner'); } public function classified_products() { return $this->hasMany(CustomerProduct::class); } public function categories() { return $this->hasMany(Category::class, 'parent_id'); } public function childrenCategories() { return $this->hasMany(Category::class, 'parent_id')->with('categories'); } public function parentCategory() { return $this->belongsTo(Category::class, 'parent_id'); } public function attributes() { return $this->belongsToMany(Attribute::class); } public function sizeChart() { return $this->belongsTo(SizeChart::class, 'id', 'category_id'); } public function sellerDiscount() { return $this->hasOne(SellerCategory::class)->where('seller_id', auth()->id()); } public function sellerDiscounts() { return $this->hasMany(SellerCategory::class); } public function productCategories() { return $this->hasMany(ProductCategory::class); } } CategoryTranslation.php000064400000000535152413172730011261 0ustar00belongsTo(Category::class); } } City.php000064400000001575152413172730006202 0ustar00hasMany(CityTranslation::class)->where('lang', $lang)->first(); return $city_translation != null ? $city_translation->$field : $this->$field; } public function city_translations(){ return $this->hasMany(CityTranslation::class); } public function areas(){ return $this->hasMany(Area::class); } public function country() { return $this->belongsTo(Country::class); } public function state() { return $this->belongsTo(State::class); } } CityTranslation.php000064400000000504152413172730010410 0ustar00belongsTo(City::class); } } ClubPoint.php000064400000000746152413172730007170 0ustar00belongsTo(User::class); } public function order(){ return $this->belongsTo(Order::class); } public function club_point_details(){ return $this->hasMany(ClubPointDetail::class); } } ClubPointDetail.php000064400000000644152413172730010310 0ustar00belongsTo(Product::class); } public function club_point() { return $this->belongsTo(ClubPoint::class); } } Color.php000064400000000301152413172730006332 0ustar00hasMany(Order::class); } public function user(){ return $this->belongsTo(User::class); } } CommissionHistory.php000064400000000452152413172730010765 0ustar00hasOne(Order::class, 'id', 'order_id'); } } Contact.php000064400000000306152413172730006654 0ustar00hasMany(Message::class); } public function sender(){ return $this->belongsTo(User::class, 'sender_id'); } public function receiver(){ return $this->belongsTo(User::class, 'receiver_id'); } } Country.php000064400000001306152413172730006725 0ustar00belongsTo(Zone::class); } public function scopeIsEnabled($query) { return $query->where('status', '1'); } public function states() { return $this->hasMany(State::class); } public function cities() { return $this->hasMany(City::class); } } Coupon.php000064400000001156152413172730006530 0ustar00belongsTo(User::class); } public function userCoupons() { return $this->hasMany(UserCoupon::class); } public function couponUsages() { return $this->hasMany(CouponUsage::class); } } CouponUsage.php000064400000000307152413172730007512 0ustar00belongsTo(User::class); } } CustomerPackage.php000064400000001430152413172730010335 0ustar00hasMany(CustomerPackageTranslation::class)->where('lang', $lang)->first(); return $brand_translation != null ? $brand_translation->$field : $this->$field; } public function customer_package_translations(){ return $this->hasMany(CustomerPackageTranslation::class); } public function customer_package_payments() { return $this->hasMany(CustomerPackagePayment::class); } } CustomerPackagePayment.php000064400000000603152413172730011674 0ustar00belongsTo(User::class); } public function customer_package(){ return $this->belongsTo(CustomerPackage::class); } } CustomerPackageTranslation.php000064400000000561152413172730012560 0ustar00belongsTo(CustomerPackage::class); } } CustomerProduct.php000064400000003264152413172730010431 0ustar00customer_product_translations->where('lang', $lang)->first(); return $customer_product_translations != null ? $customer_product_translations->$field : $this->$field; } public function scopeIsActiveAndApproval($query) { return $query->where('status', '1') ->where('published', '1'); } public function category() { return $this->belongsTo(Category::class); } public function subcategory() { return $this->belongsTo(SubCategory::class); } public function subsubcategory() { return $this->belongsTo(SubSubCategory::class); } public function brand() { return $this->belongsTo(Brand::class); } public function user() { return $this->belongsTo(User::class); } public function state() { return $this->belongsTo(State::class); } public function city() { return $this->belongsTo(City::class); } public function customer_product_translations() { return $this->hasMany(CustomerProductTranslation::class); } public function thumbnail() { return $this->belongsTo(Upload::class, 'thumbnail_img'); } } CustomerProductTranslation.php000064400000000572152413172730012647 0ustar00belongsTo(CustomerProduct::class); } } CustomersImport.php000064400000000727152413172730010447 0ustar00 $row['user_id'], ]); } } CustomLabel.php000064400000001534152413172730007477 0ustar00belongsTo(User::class); } public function getTranslation($field = '', $lang = false) { $lang = $lang == false ? App::getLocale() : $lang; $custom_label_translation = $this->custom_label_translations->where('lang', $lang)->first(); return $custom_label_translation != null ? $custom_label_translation->$field : $this->$field; } public function custom_label_translations() { return $this->hasMany(CustomLabelTranslation::class); } } CustomLabelTranslation.php000064400000000477152413172730011723 0ustar00belongsTo(Product::class); } } DeliveryBoy.php000064400000000417152413172730007521 0ustar00belongsTo(User::class); } } DeliveryBoyCollection.php000064400000000537152413172730011540 0ustar00belongsTo(User::class); } } DeliveryBoyPayment.php000064400000000534152413172730011057 0ustar00belongsTo(User::class); } } DeliveryHistory.php000064400000000436152413172730010432 0ustar00belongsTo(Order::class); } } DynamicPopup.php000064400000000726152413172730007677 0ustar00element_translations->where('lang', $lang)->first(); return $element_translation != null ? $element_translation->$field : $this->$field; } public function element_translations() { return $this->hasMany(ElementTranslation::class); } public function element_types() { return $this->hasMany(ElementType::class); } } ElementStyle.php000064400000000511152413172730007671 0ustar00belongsTo(ElementType::class); } } ElementTranslation.php000064400000000520152413172730011067 0ustar00belongsTo(Element::class); } } ElementType.php000064400000001007152413172730007513 0ustar00belongsTo(Element::class); } public function image() { return $this->belongsTo(Upload::class,); } public function element_styles() { return $this->hasMany(ElementStyle::class); } } EmailTemplate.php000064400000000303152413172730010001 0ustar00faq_translations->where('lang', $lang)->first(); return $faq_translation != null ? $faq_translation->$field : $this->$field; } public function faq_translations() { return $this->hasMany(FaqTranslation::class); } } FaqTranslation.php000064400000000533152413172730010211 0ustar00belongsTo(Faq::class); } } FirebaseNotification.php000064400000000216152413172730011350 0ustar00flash_deal_translations->where('lang', $lang)->first(); return $flash_deal_translation != null ? $flash_deal_translation->$field : $this->$field; } public function flash_deal_translations(){ return $this->hasMany(FlashDealTranslation::class); } public function flash_deal_products() { return $this->hasMany(FlashDealProduct::class); } public function scopeIsActiveAndFeatured($query) { return $query->where('status', '1') ->where('featured', '1'); } } FlashDealProduct.php000064400000000705152413172730010450 0ustar00belongsTo(Product::class); } public function flash_deal() { return $this->belongsTo(FlashDeal::class); } } FlashDealTranslation.php000064400000000535152413172730011327 0ustar00belongsTo(FlashDeal::class); } } FollowSeller.php000064400000000475152413172730007701 0ustar00belongsTo(Shop::class); } } FrequentlyBoughtProduct.php000064400000001006152413172730012127 0ustar00belongsTo(Product::class); } public function frequently_bought_product() { return $this->belongsTo(Product::class, 'frequently_bought_product_id'); } } FrequentlyBroughtProduct.php000064400000001007152413172730012312 0ustar00belongsTo(Product::class); } public function frequently_bought_product() { return $this->belongsTo(Product::class, 'frequently_bought_product_id'); } } Language.php000064400000000312152413172730007001 0ustar00belongsTo(Product::class); } } ManualPaymentMethod.php000064400000000345152413172730011200 0ustar00belongsTo(Conversation::class); } public function user(){ return $this->belongsTo(User::class); } } Note.php000064400000001367152413172730006176 0ustar00note_translations->where('lang', $lang)->first(); return $note_translation != null ? $note_translation->$field : $this->$field; } public function note_translations() { return $this->hasMany(NoteTranslation::class); } public function user() { return $this->belongsTo(User::class); } } NoteTranslation.php000064400000000516152413172730010410 0ustar00belongsTo(Brand::class); } } NotificationType.php000064400000001161152413172730010551 0ustar00notificationTypeTranslations->where('lang', $lang)->first(); return $notificationTypeTtranslation != null ? $notificationTypeTtranslation->$field : $this->$field; } public function notificationTypeTranslations() { return $this->hasMany(NotificationTypeTranslation::class); } } NotificationTypeTranslation.php000064400000000506152413172730012772 0ustar00belongsTo(NotificationType::class); } } Order.php000064400000003105152413172730006334 0ustar00hasMany(OrderDetail::class); } public function refund_requests() { return $this->hasMany(RefundRequest::class); } public function user() { return $this->belongsTo(User::class); } public function shop() { return $this->hasOne(Shop::class, 'user_id', 'seller_id'); } public function seller() { return $this->belongsTo(User::class, 'seller_id'); } public function operatorUser() { return $this->belongsTo(User::class, 'operator'); } public function pickup_point() { return $this->belongsTo(PickupPoint::class); } public function carrier() { return $this->belongsTo(Carrier::class); } public function affiliate_log() { return $this->hasMany(AffiliateLog::class); } public function club_point() { return $this->hasMany(ClubPoint::class); } public function delivery_boy() { return $this->belongsTo(User::class, 'assign_delivery_boy', 'id'); } public function proxy_cart_reference_id() { return $this->hasMany(ProxyPayment::class)->select('reference_id'); } public function commissionHistory() { return $this->hasOne(CommissionHistory::class); } } OrderDetail.php000064400000001272152413172730007462 0ustar00belongsTo(Order::class); } public function product() { return $this->belongsTo(Product::class); } public function pickup_point() { return $this->belongsTo(PickupPoint::class); } public function refund_request() { return $this->hasOne(RefundRequest::class); } public function affiliate_log() { return $this->hasMany(AffiliateLog::class); } } OrdersExport.php000064400000002702152413172730007723 0ustar00order_ids = $order_ids; } public function collection() { return Order::findMany($this->order_ids); } public function headings(): array { return [ 'Order Code', 'Num. of Products', 'Customer', 'Seller', 'Amount', 'Delivery Status', 'Payment method', 'Payment Status', ]; } /** * @var Order $order */ public function map($order): array { return [ $order->code, count($order->orderDetails), $order->user != null ? $order->user->name : '', $order->shop != null ? $order->shop->name : translate('Inhouse Order'), single_price($order->grand_total), translate(ucfirst(str_replace('_', ' ', $order->delivery_status))), translate(ucfirst(str_replace('_', ' ', $order->payment_type))), translate(ucfirst($order->payment_status)), ]; } }OtpConfiguration.php000064400000000314152413172730010552 0ustar00hasMany(PageTranslation::class)->where('lang', $lang)->first(); return $page_translation != null ? $page_translation->$field : $this->$field; } public function page_translations(){ return $this->hasMany(PageTranslation::class); } } PageTranslation.php000064400000000520152413172730010352 0ustar00belongsTo(Page::class); } } PasswordReset.php000064400000000360152413172730010066 0ustar00pickup_point_translations->where('lang', $lang)->first(); return $pickup_point_translation != null ? $pickup_point_translation->$field : $this->$field; } public function pickup_point_translations(){ return $this->hasMany(PickupPointTranslation::class); } public function staff(){ return $this->belongsTo(Staff::class); } public function scopeIsActive($query) { return $query->where('pick_up_status', '1'); } } PickupPointTranslation.php000064400000000566152413172730011755 0ustar00belongsTo(PickupPoint::class); } } Policy.php000064400000000302152413172730006514 0ustar00belongsTo(User::class); } public function preorder_product(){ return $this->belongsTo(PreorderProduct::class,'product_id'); } public function address(){ return $this->belongsTo(Address::class)->with(['country','state','city']); } public function shop() { return $this->hasOne(Shop::class, 'user_id', 'product_owner_id'); } public function preorderCommissionHistory() { return $this->hasOne(PreorderCommissionHistory::class); } } PreorderCashondelivery.php000064400000000546152413172730011751 0ustar00belongsTo(Note::class); } } PreorderCommissionHistory.php000064400000000501152413172730012463 0ustar00belongsTo(Preorder::class); } } PreorderConversationMessage.php000064400000000775152413172730012755 0ustar00belongsTo(PreorderConversationThread::class); } public function sender(){ return $this->belongsTo(User::class, 'sender_id'); } } PreorderConversationThread.php000064400000001434152413172730012571 0ustar00belongsTo(PreorderProduct::class); } public function sender() { return $this->belongsTo(User::class, 'sender_id'); } public function receiver() { return $this->belongsTo(User::class, 'receiver_id'); } public function messages() { return $this->hasMany(PreorderConversationMessage::class); } } PreorderCoupon.php000064400000000607152413172730010233 0ustar00belongsTo(PreorderProduct::class,'preorder_product_id'); } } PreorderDiscount.php000064400000000405152413172730010554 0ustar00preorder_product_translations->where('lang', $lang)->first(); return $preorder_product_translation != null ? $preorder_product_translation->$field : $this->$field; } public function preorder_product_translations() { return $this->hasMany(PreorderProductTranslation::class); } public function category() { return $this->belongsTo(Category::class); } public function main_category() { return $this->belongsTo(Category::class, 'category_id'); } public function categories() { return $this->belongsToMany(Category::class, 'preorder_product_categories'); } public function brand() { return $this->belongsTo(Brand::class); } public function product_queries() { return $this->hasMany(ProductQuery::class); } public function user() { return $this->belongsTo(User::class); } public function preorder_prepayment() { return $this->belongsTo(PreorderPrepayment::class); } public function preorder_sample_order() { return $this->belongsTo(PreorderSampleOrder::class); } public function preorder_coupon() { return $this->belongsTo(PreorderCoupon::class); } public function preorder_refund() { return $this->hasOne(PreorderRefund::class); } public function preorder_cod() { return $this->hasOne(PreorderCashondelivery::class); } public function preorder_discount() { return $this->belongsTo(PreorderDiscount::class); } public function preorder_shipping() { return $this->hasOne(PreorderShipping::class); } public function preorder_stock() { return $this->belongsTo(PreorderStock::class); } public function preorder_product_taxes() { return $this->hasMany(PreorderProductTax::class)->with('preorder_tax'); } public function preorder_discount_periods() { return $this->hasMany(PreorderDiscountPeriod::class); } public function preorder_wholesale_prices() { return $this->hasMany(PreorderWholesalePrice::class); } public function preorder() { return $this->hasMany(Preorder::class,'product_id'); } public function preorderProductQueries() { return $this->hasMany(PreorderProductQuery::class); } public function preorderProductreviews() { return $this->hasMany(PreorderProductReview::class); } public function taxes() { return $this->hasMany(PreorderProductTax::class)->with('preorder_tax'); } public function preorderConversations() { return $this->hasMany(PreorderConversationThread::class); } } PreorderProductCategory.php000064400000000730152413172730012103 0ustar00belongsTo(Product::class); } public function category() { return $this->belongsTo(Category::class); } } PreorderProductQuery.php000064400000000741152413172730011435 0ustar00belongsTo(PreorderProduct::class); } public function user(){ return $this->belongsTo(User::class,'customer_id'); } } PreorderProductReview.php000064400000000565152413172730011575 0ustar00belongsTo(User::class); } public function preorderProduct(){ return $this->belongsTo(PreorderProduct::class); } } PreorderProductTax.php000064400000000563152413172730011066 0ustar00belongsTo(Tax::class, 'tax_id'); } } PreorderProductTranslation.php000064400000000733152413172730012627 0ustar00belongsTo(PreorderProduct::class); } } PreorderRefund.php000064400000000542152413172730010211 0ustar00belongsTo(Note::class); } } PreorderSampleOrder.php000064400000000410152413172730011175 0ustar00belongsTo(Note::class); } } PreorderStock.php000064400000000402152413172730010044 0ustar00product_translations->where('lang', $lang)->first(); return $product_translations != null ? $product_translations->$field : $this->$field; } public function product_translations() { return $this->hasMany(ProductTranslation::class); } public function main_category() { return $this->belongsTo(Category::class, 'category_id'); } public function categories() { return $this->belongsToMany(Category::class, 'product_categories'); } public function frequently_bought_products() { return $this->hasMany(FrequentlyBoughtProduct::class); } public function product_categories() { return $this->hasMany(ProductCategory::class); } public function brand() { return $this->belongsTo(Brand::class); } public function user() { return $this->belongsTo(User::class); } public function orderDetails() { return $this->hasMany(OrderDetail::class); } public function reviews() { return $this->hasMany(Review::class); } public function product_queries() { return $this->hasMany(ProductQuery::class); } public function wishlists() { return $this->hasMany(Wishlist::class); } public function stocks() { return $this->hasMany(ProductStock::class); } public function taxes() { return $this->hasMany(ProductTax::class); } public function flash_deal_products() { return $this->hasMany(FlashDealProduct::class); } public function bids() { return $this->hasMany(AuctionProductBid::class); } public function thumbnail() { return $this->belongsTo(Upload::class, 'thumbnail_img'); } public function scopePhysical($query) { return $query->where('digital', 0); } public function scopeDigital($query) { return $query->where('digital', 1); } public function carts() { return $this->hasMany(Cart::class); } public function scopeIsApprovedPublished($query) { return $query->where('approved', '1')->where('published', 1); } public function last_viewed_products() { return $this->hasMany(LastViewedProduct::class); } public function warranty() { return $this->belongsTo(Warranty::class); } public function warrantyNote() { return $this->belongsTo(Note::class, 'warranty_note_id'); } public function refundNote() { return $this->belongsTo(Note::class, 'refund_note_id'); } public function shippingNote() { return $this->belongsTo(Note::class, 'shipping_note_id'); } public function codNote() { return $this->belongsTo(Note::class, 'delivery_note_id'); } public function customSaleAlerts() { return $this->hasMany(CustomSaleAlert::class, 'product_id'); } // add gallery image to thumb public function thumbnailImg(): Attribute { return Attribute::get(function ($value, $attributes) { $photos = $attributes['photos'] ?? null; if ($photos) { $photosArray = explode(',', $photos); $count = count($photosArray); return $value ?: ($count > 0 ? $photosArray[0] : null); } return $value; }); } protected function videoLink(): Attribute { return Attribute::make( get: fn($value) => json_decode($value, true), set: function ($value) { if (!is_array($value)) { return null; } $filtered = array_filter($value, function ($item) { return trim($item) !== ''; }); return empty($filtered) ? null : json_encode($filtered); }, ); } } ProductCategory.php000064400000000710152413172730010376 0ustar00belongsTo(Product::class); } public function category() { return $this->belongsTo(Category::class); } } ProductQuery.php000064400000000711152413172730007727 0ustar00belongsTo(Product::class); } public function user(){ return $this->belongsTo(User::class,'customer_id'); } } ProductsExport.php000064400000003211152413172730010264 0ustar00stocks as $key => $stock) { $qty += $stock->qty; } return [ $product->name, $product->description, $product->added_by, $product->user_id, $product->category_id, $product->brand_id, $product->video_provider, $product->video_link, $product->unit_price, $product->unit, $qty, $product->est_shipping_days, $product->meta_title, $product->meta_description, ]; } } ProductsImport.php000064400000011533152413172730010263 0ustar00user_type == 'seller' && addon_is_activated('seller_subscription')) { if ((count($rows) + $user->products()->count()) > $user->shop->product_upload_limit || $user->shop->package_invalid_at == null || Carbon::now()->diffInDays(Carbon::parse($user->shop->package_invalid_at), false) < 0 ) { $canImport = false; flash(translate('Please upgrade your package.'))->warning(); } } if ($canImport) { foreach ($rows as $row) { $approved = 1; if ($user->user_type == 'seller' && get_setting('product_approve_by_admin') == 1) { $approved = 0; } $productId = Product::create([ 'name' => $row['name'], 'description' => $row['description'], 'added_by' => $user->user_type == 'seller' ? 'seller' : 'admin', 'user_id' => $user->user_type == 'seller' ? $user->id : User::where('user_type', 'admin')->first()->id, 'approved' => $approved, 'category_id' => $row['category_id'], 'brand_id' => $row['brand_id'], 'video_provider' => $row['video_provider'], 'video_link' => $row['video_link'], 'tags' => $row['tags'], 'unit_price' => $row['unit_price'], 'unit' => $row['unit'], 'meta_title' => $row['meta_title'], 'meta_description' => $row['meta_description'], 'est_shipping_days' => $row['est_shipping_days'], 'colors' => json_encode(array()), 'choice_options' => json_encode(array()), 'variations' => json_encode(array()), 'slug' => preg_replace('/[^A-Za-z0-9\-]/', '', str_replace(' ', '-', strtolower($row['slug']))) . '-' . Str::random(5), 'thumbnail_img' => $this->downloadThumbnail($row['thumbnail_img']), 'photos' => $this->downloadGalleryImages($row['photos']), ]); ProductStock::create([ 'product_id' => $productId->id, 'qty' => $row['current_stock'], 'price' => $row['unit_price'], 'sku' => $row['sku'], 'variant' => '', ]); if($row['multi_categories'] != null){ foreach (explode(',', $row['multi_categories']) as $category_id) { ProductCategory::insert([ "product_id" => $productId->id, "category_id" => $category_id ]); } } } flash(translate('Products imported successfully'))->success(); } } public function model(array $row) { ++$this->rows; } public function getRowCount(): int { return $this->rows; } public function rules(): array { return [ // Can also use callback validation rules 'unit_price' => function ($attribute, $value, $onFailure) { if (!is_numeric($value)) { $onFailure('Unit price is not numeric'); } } ]; } public function downloadThumbnail($url) { try { $upload = new Upload; $upload->external_link = $url; $upload->type = 'image'; $upload->save(); return $upload->id; } catch (\Exception $e) { } return null; } public function downloadGalleryImages($urls) { $data = array(); foreach (explode(',', str_replace(' ', '', $urls)) as $url) { $data[] = $this->downloadThumbnail($url); } return implode(',', $data); } } ProductStock.php000064400000000735152413172730007713 0ustar00belongsTo(Product::class); } public function wholesalePrices() { return $this->hasMany(WholesalePrice::class); } } ProductTax.php000064400000000306152413172730007356 0ustar00belongsTo(Product::class); } } ProxyPayment.php000064400000000355152413172730007744 0ustar00 'datetime', 'dispute_refund_created_at' => 'datetime', 'dispute_refund_approval_datatime' => 'datetime', 'seller_refund_approval_datatime' => 'datetime', ]; public function orderDetail() { return $this->belongsTo(OrderDetail::class); } public function user() { return $this->belongsTo(User::class); } public function seller() { return $this->belongsTo(User::class, 'seller_id'); } public function order() { return $this->belongsTo(Order::class); } public function paymentInformation() { return $this->belongsTo(PaymentInformation::class, 'payment_information_id'); } public function refund_reason() { return $this->belongsTo(RefundReason::class, 'reason'); } public function getReasonTextAttribute() { return is_numeric($this->reason) ? optional($this->refund_reason)->reason : $this->reason; } public function dispute_reason_relation() { return $this->belongsTo(RefundReason::class, 'dispute_reason'); } public function getDisputeReasonTextAttribute() { return is_numeric($this->dispute_reason) ? optional($this->dispute_reason_relation)->reason : $this->dispute_reason; } public function seller_reject_reason_relation() { return $this->belongsTo(RefundReason::class, 'reject_reason'); } public function getSellerRejectReasonDisplayAttribute() { return is_numeric($this->reject_reason) ? optional($this->seller_reject_reason_relation)->reason : $this->reject_reason; } public function dispute_reject_reason_relation() { return $this->belongsTo(RefundReason::class, 'dispute_reject_reason'); } public function getDisputeRejectReasonDisplayAttribute() { return is_numeric($this->dispute_reject_reason) ? optional($this->dispute_reject_reason_relation)->reason : $this->dispute_reject_reason; } public function admin_reject_reason_relation() { return $this->belongsTo(RefundReason::class, 'admin_reject_reason'); } public function getAdminRejectReasonDisplayAttribute() { return is_numeric($this->admin_reject_reason) ? optional($this->admin_reject_reason_relation)->reason : $this->admin_reject_reason; } public function admin_dispute_reject_reason_relation() { return $this->belongsTo(RefundReason::class, 'admin_dispute_reject_reason'); } public function getAdminDisputeRejectReasonDisplayAttribute() { return is_numeric($this->admin_dispute_reject_reason) ? optional($this->admin_dispute_reject_reason_relation)->reason : $this->admin_dispute_reject_reason; } } RegistrationVerificationCode.php000064400000000411152413172730013066 0ustar00belongsTo(User::class); } public function product(){ return $this->belongsTo(Product::class); } } Role.php000064400000001212152413172730006157 0ustar00role_translations->where('lang', $lang)->first(); return $role_translation != null ? $role_translation->$field : $this->$field; } public function role_translations(){ return $this->hasMany(RoleTranslation::class); } } RoleTranslation.php000064400000000514152413172730010402 0ustar00belongsTo(Role::class); } } Search.php000064400000000276152413172730006474 0ustar00belongsTo(User::class); } public function payments(){ return $this->hasMany(Payment::class); } public function seller_package(){ return $this->belongsTo(SellerPackage::class); } } SellerCategory.php000064400000001025152413172730010204 0ustar00belongsTo(Category::class); } } SellerPackage.php000064400000001644152413172730007771 0ustar00hasMany(SellerPackageTranslation::class)->where('lang', $lang)->first(); return $seller_package_translation != null ? $seller_package_translation->$field : $this->$field; } public function seller_package_translations(){ return $this->hasMany(SellerPackageTranslation::class); } public function seller_package_payments() { return $this->hasMany(SelllerPackagePayment::class); } public function shop() { return $this->hasOne(Shop::class); } } SellerPackagePayment.php000064400000000575152413172730011331 0ustar00belongsTo(User::class); } public function seller_package(){ return $this->belongsTo(SellerPackage::class); } } SellerPackageTranslation.php000064400000000562152413172730012206 0ustar00belongsTo(SellerPackage::class); } } SellerWithdrawRequest.php000064400000000573152413172730011600 0ustar00belongsTo(User::class); } public function shop() { return $this->belongsTo(Shop::class); } } ShippingBoxSize.php000064400000000454152413172730010352 0ustar00belongsTo(User::class); } public function seller_package(){ return $this->belongsTo(SellerPackage::class); } public function followers(){ return $this->hasMany(FollowSeller::class); } } SizeChart.php000064400000000662152413172730007162 0ustar00hasMany(SizeChartDetail::class); } public function category() { return $this->belongsTo(Category::class); } } SizeChartDetail.php000064400000000341152413172730010277 0ustar00belongsTo(User::class); } public function role() { return $this->belongsTo(Role::class); } public function pick_up_point() { return $this->hasOne(PickupPoint::class); } } State.php000064400000000654152413172730006347 0ustar00belongsTo(Country::class); } public function cities(){ return $this->hasMany(City::class); } } SubCategory.php000064400000003003152413172730007505 0ustar00belongsTo(Category::class); } public function products() { return $this->hasMany(Product::class); } public function subSubCategories() { return $this->hasMany(SubSubCategory::class); } } Subscriber.php000064400000000302152413172730007360 0ustar00orderBy('name', 'asc'); }); } public function subCategory() { return $this->belongsTo(SubCategory::class); } } Tax.php000064400000000430152413172730006013 0ustar00hasMany(ProductTax::class); } } Ticket.php000064400000000624152413172730006507 0ustar00belongsTo(User::class); } public function ticketreplies() { return $this->hasMany(TicketReply::class)->orderBy('created_at', 'desc'); } } TicketReply.php000064400000000543152413172730007523 0ustar00belongsTo(Ticket::class); } public function user(){ return $this->belongsTo(User::class); } } TopBanner.php000064400000001361152413172730007153 0ustar00top_banner_translations->where('lang', $lang)->first(); return $top_banner_translation != null ? $top_banner_translation->$field : $this->$field; } public function top_banner_translations() { return $this->hasMany(TopBannerTranslation::class); } } TopBannerTranslation.php000064400000000471152413172730011373 0ustar00belongsTo(User::class); } } User.php000064400000007720152413172730006206 0ustar00notify(new EmailVerificationNotification()); } /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', 'address', 'city', 'postal_code', 'phone', 'country', 'provider_id', 'email_verified_at', 'verification_code', 'verification_status' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; public function wishlists() { return $this->hasMany(Wishlist::class); } public function customer() { return $this->hasOne(Customer::class); } public function affiliate_user() { return $this->hasOne(AffiliateUser::class); } public function affiliate_withdraw_request() { return $this->hasMany(AffiliateWithdrawRequest::class); } public function products() { return $this->hasMany(Product::class); } public function shop() { return $this->hasOne(Shop::class); } public function seller() { return $this->hasOne(Seller::class); } public function staff() { return $this->hasOne(Staff::class); } public function orders() { return $this->hasMany(Order::class); } public function seller_orders() { return $this->hasMany(Order::class, "seller_id"); } public function seller_sales() { return $this->hasMany(OrderDetail::class, "seller_id"); } public function wallets() { return $this->hasMany(Wallet::class)->orderBy('created_at', 'desc'); } public function club_point() { return $this->hasOne(ClubPoint::class); } public function customer_package() { return $this->belongsTo(CustomerPackage::class); } public function customer_package_payments() { return $this->hasMany(CustomerPackagePayment::class); } public function customer_products() { return $this->hasMany(CustomerProduct::class); } public function seller_package_payments() { return $this->hasMany(SellerPackagePayment::class); } public function carts() { return $this->hasMany(Cart::class); } public function reviews() { return $this->hasMany(Review::class); } public function addresses() { return $this->hasMany(Address::class); } public function payment_informations() { return $this->hasMany(PaymentInformation::class); } public function affiliate_log() { return $this->hasMany(AffiliateLog::class); } public function product_bids() { return $this->hasMany(AuctionProductBid::class); } public function product_queries(){ return $this->hasMany(ProductQuery::class,'customer_id'); } public function uploads(){ return $this->hasMany(Upload::class); } public function userCoupon(){ return $this->hasOne(UserCoupon::class); } public function preorderProducts() { return $this->hasMany(PreorderProduct::class); } public function preorders() { return $this->hasMany(Preorder::class); } } UserCoupon.php000064400000000711152413172730007363 0ustar00belongsTo(User::class); } public function coupon(){ return $this->belongsTo(Coupon::class); } } Wallet.php000064400000000412152413172730006507 0ustar00belongsTo(User::class); } } Warranty.php000064400000001274152413172730007075 0ustar00warranty_translations->where('lang', $lang)->first(); return $warranty_translation != null ? $warranty_translation->$field : $this->$field; } public function warranty_translations() { return $this->hasMany(WarrantyTranslation::class); } } WarrantyTranslation.php000064400000000524152413172730011311 0ustar00belongsTo(Warranty::class); } } WholesalePrice.php000064400000000406152413172730010170 0ustar00belongsTo(Product::class); } }Zone.php000064400000000633152413172730006177 0ustar00hasMany(CarrierRangePrice::class); } } PaymentInformation.php000064400000001611152413172730011104 0ustar00belongsTo(OfflinePayoutMethod::class, 'bank_name'); } public function other_payout_method() { return $this->belongsTo(OfflinePayoutMethod::class, 'payment_name'); } public function getBankNameTextAttribute() { return is_numeric($this->bank_name) ? optional($this->payout_method)->name : $this->bank_name; } public function getPaymentNameTextAttribute() { return is_numeric($this->payment_name) ? optional($this->other_payout_method)->name : $this->payment_name; } } RedxPickupStore.php000064400000000436152413172730010360 0ustar00belongsTo(User::class); } } CjSetting.php000064400000003430152413172730007154 0ustar00 'boolean', 'auto_fulfill_enabled' => 'boolean', 'round_to_99' => 'boolean', 'auto_fulfill_category_ids' => 'array', 'supported_country_codes' => 'array', 'last_health_check_at' => 'datetime', ]; public static function singleton(): self { return self::firstOrCreate(['id' => 1], [ 'api_base_url' => 'https://developers.cjdropshipping.com/api2.0/v1', 'environment' => 'production', 'enabled' => false, 'auto_fulfill_enabled' => false, 'percent_markup' => 0, 'fixed_markup' => 0, 'minimum_profit' => 0, 'fx_buffer_percent' => 0, 'round_to_99' => true, 'default_shipping_cost' => 0, 'auto_fulfill_category_ids' => json_encode([]), 'supported_country_codes' => json_encode([]), ]); } public function categoryIds(): array { $ids = $this->auto_fulfill_category_ids ?? []; return is_array($ids) ? array_values(array_filter($ids)) : []; } public function supportedCountries(): array { $countries = $this->supported_country_codes ?? []; return is_array($countries) ? array_map('strtoupper', array_values(array_filter($countries))) : []; } public function supportsCountry(?string $countryCode): bool { $allowed = $this->supportedCountries(); if (empty($allowed)) { return true; } if (!$countryCode) { return false; } return in_array(strtoupper(trim($countryCode)), $allowed, true); } } CjProductMap.php000064400000001003152413172730007607 0ustar00 'boolean', 'is_active' => 'boolean', 'meta' => 'array', 'last_synced_at' => 'datetime', ]; public function product() { return $this->belongsTo(Product::class); } public function stock() { return $this->belongsTo(ProductStock::class, 'product_stock_id'); } } CjOrderMap.php000064400000001143152413172730007247 0ustar00 'boolean', 'meta' => 'array', 'last_synced_at' => 'datetime', 'last_attempt_at' => 'datetime', ]; public function order() { return $this->belongsTo(Order::class); } public function orderDetail() { return $this->belongsTo(OrderDetail::class, 'order_detail_id'); } public function product() { return $this->belongsTo(Product::class); } } CjSyncLog.php000064400000000305152413172730007113 0ustar00 'array', ]; } StaffActivityLog.php000064400000000514152413172730010504 0ustar00 'array', 'input_payload' => 'array', ]; public function user() { return $this->belongsTo(User::class); } } PromotionalProduct.php000064400000000271152413172730011126 0ustar00refund_reason_translations->where('lang', $lang)->first(); return $refund_reason_translation != null ? $refund_reason_translation->$field : $this->$field; } public function refund_reason_translations() { return $this->hasMany(RefundReasonTranslation::class); } } RefundReasonTranslation.php000064400000000540152413172730012073 0ustar00belongsTo(RefundReason::class); } } ShippingLabelDownload.php000064400000000274152413172730011476 0ustar00