public function bidOnItem($itemId) { $userId = Auth::id(); $authModel = config('auth.model'); $user = with(new $authModel())->with(['bid'])->find($userId); if (empty($user) || empty($user->bid)) { throw new Exception(sprintf('User ID %d failed to bid on item ID %d', $userId, $itemId)); return false; } $item = Item::where('id', $itemId)->firstOrFail(); dd($item->id); }
public function getAllCurrentListings() { return Item::where('active', 1)->get(); }