sliderRepository = $sliderRepository; $this->searchRepository = $searchRepository; parent::__construct(); } /** * loads the home page for the storefront * * @return \Illuminate\View\View */ public function index() { $currentChannel = core()->getCurrentChannel(); $currentLocale = core()->getCurrentLocale(); $sliderData = $this->sliderRepository ->where('channel_id', $currentChannel->id) ->whereRaw("find_in_set(?, locale)", [$currentLocale->code]) ->where(function ($query) { $query->where('expired_at', '>=', Carbon::now()->format('Y-m-d')) ->orWhereNull('expired_at'); }) ->get() ->toArray(); usort($sliderData, function ($a, $b) { if ($a['sort_order'] == $b['sort_order']) { return 0; } return ($a['sort_order'] < $b['sort_order']) ? -1 : 1; }); return view($this->_config['view'], compact('sliderData')); } /** * loads the home page for the storefront * * @return \Exception */ public function notFound() { abort(404); } /** * Upload image for product search with machine learning * * @return \Illuminate\Http\Response */ public function upload() { $url = $this->searchRepository->uploadSearchImage(request()->all()); return $url; } }