PATH:
home
/
lab2454c
/
vaultchip.com
/
platform
/
plugins
/
ecommerce
/
src
/
Repositories
/
Eloquent
<?php namespace Botble\Ecommerce\Repositories\Eloquent; use Botble\Base\Enums\BaseStatusEnum; use Botble\Ecommerce\Repositories\Interfaces\ProductCategoryInterface; use Botble\Support\Repositories\Eloquent\RepositoriesAbstract; class ProductCategoryRepository extends RepositoriesAbstract implements ProductCategoryInterface { /** * {@inheritDoc} */ public function getCategories(array $param) { $param = array_merge([ 'active' => true, 'order_by' => 'desc', 'is_child' => null, 'is_featured' => null, 'num' => null, ], $param); $data = $this->model; if ($param['active']) { $data = $data->where('status', BaseStatusEnum::PUBLISHED); } if ($param['is_child'] !== null) { if ($param['is_child'] === true) { $data = $data->where('parent_id', '<>', 0); } else { $data = $data->where('parent_id', 0); } } if ($param['is_featured']) { $data = $data->where('is_featured', $param['is_featured']); } $data = $data->orderBy('order', $param['order_by']); if ($param['num'] !== null) { $data = $data->limit($param['num']); } return $this->applyBeforeExecuteQuery($data)->get(); } /** * {@inheritDoc} */ public function getDataSiteMap() { $data = $this->model ->where('status', BaseStatusEnum::PUBLISHED) ->orderBy('created_at', 'desc'); return $this->applyBeforeExecuteQuery($data)->get(); } /** * {@inheritDoc} */ public function getFeaturedCategories($limit) { $data = $this->model ->where([ 'status' => BaseStatusEnum::PUBLISHED, 'is_featured' => 1, ]) ->select([ 'id', 'name', 'icon', ]) ->orderBy('order') ->limit($limit); return $this->applyBeforeExecuteQuery($data)->get(); } /** * {@inheritDoc} */ public function getAllCategories($active = true) { $data = $this->model; if ($active) { $data = $data->where(['status' => BaseStatusEnum::PUBLISHED]); } return $this->applyBeforeExecuteQuery($data)->get(); } /** * {@inheritDoc} */ public function getProductCategories( array $conditions = [], array $with = [], array $withCount = [], bool $parentOnly = false ) { $data = $this->model; if (!empty($conditions)) { $data = $data->where($conditions); } if (!empty($with)) { $data = $data->with($with); } if (!empty($withCount)) { $data = $data->withCount($withCount); } if ($parentOnly) { $data = $data->where(function ($query) { $query->whereNull('parent_id') ->orWhere('parent_id', 0) ->orWhere('parent_id', ''); }); } $data = $data ->orderBy('order', 'ASC') ->orderBy('created_at', 'DESC'); return $this->applyBeforeExecuteQuery($data)->get(); } }
[-] ProductAttributeSetRepository.php
[edit]
[-] ProductTagRepository.php
[edit]
[-] ProductAttributeRepository.php
[edit]
[-] ReviewRepository.php
[edit]
[-] FlashSaleRepository.php
[edit]
[+]
..
[-] OrderRepository.php
[edit]
[-] CurrencyRepository.php
[edit]
[-] ProductCollectionRepository.php
[edit]
[-] TaxRepository.php
[edit]
[-] ProductCategoryRepository.php
[edit]
[-] OrderProductRepository.php
[edit]
[-] ShipmentRepository.php
[edit]
[-] ShippingRuleRepository.php
[edit]
[-] ShipmentHistoryRepository.php
[edit]
[-] WishlistRepository.php
[edit]
[-] DiscountRepository.php
[edit]
[-] OrderAddressRepository.php
[edit]
[-] CustomerRepository.php
[edit]
[-] AddressRepository.php
[edit]
[-] ShippingRuleItemRepository.php
[edit]
[-] OrderHistoryRepository.php
[edit]
[-] ProductVariationItemRepository.php
[edit]
[-] GroupedProductRepository.php
[edit]
[-] StoreLocatorRepository.php
[edit]
[-] BrandRepository.php
[edit]
[-] ProductVariationRepository.php
[edit]
[-] ProductRepository.php
[edit]
[-] ProductLabelRepository.php
[edit]
[-] ShippingRepository.php
[edit]