/** * Redirect index requests or return view. * * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View */ public function getIndex() { $front_page = config('mustard.front_page', '/buy'); if (view()->exists(config('mustard.front_page'))) { return view(config('mustard.front_page')); } session()->reflash(); return mustard_redirect(config('mustard.front_page')); }
/** * Return the item summary view. * * @param int $itemId * * @return \Illuminate\View\View */ public function getIndex($itemId) { $item = Item::findOrFail($itemId); if (!$item->isStarted() && $item->seller->userId != Auth::user()->userId) { return mustard_redirect('/'); } if (mustard_loaded('media')) { $photos = $item->photos()->orderBy('primary', 'desc')->get(); if ($photos->isEmpty()) { $photos->push(new Photo()); } } $bids = mustard_loaded('auctions') ? $item->getBidHistory() : new Collection(); $highest_bid = mustard_loaded('auctions') ? $bids->first() ?: new \Hamjoint\Mustard\Auctions\Bid() : new Collection(); return view('mustard::item.summary', ['item' => $item, 'photos' => $photos, 'bids' => $bids, 'highest_bid' => $highest_bid]); }
/** * Redirect index requests to the password page. * * @return \Illuminate\Http\RedirectResponse */ public function index() { return mustard_redirect('/account/password'); }
/** * Redirect index requests to the watching page. * * @return \Illuminate\Http\RedirectResponse */ public function getIndex() { return mustard_redirect('/inventory/watching'); }
/** * Redirect index requests to the dashboard page. * * @return \Illuminate\Http\RedirectResponse */ public function index() { return mustard_redirect('/admin/dashboard'); }