public function index() { $category = Category::get(); $advertCountImoveis = AdvertImovel::count(); $advertCountVeiculos = AdvertImovel::count(); $advertCountTotal = Advert::count(); $imageCount = AdvertImage::count(); $userCount = User::count(); return view('site.pages.home', ['categories' => $category, 'advertCountImoveis' => $advertCountImoveis, 'advertCountTotal' => $advertCountTotal, 'advertCountVeiculos' => $advertCountVeiculos, 'imageCount' => $imageCount, 'userCount' => $userCount]); }
public function home(User $user) { Session::put('lances', $leilao = $this->leilao->where('visto', '>', '0')->count()); $user = Auth::user(); $countOfertas = AdvertVeiculo::where('leilao', '>', 0)->count(); if ($user->typeuser_id == 1) { $queryCountTotal = Advert::count(); $countTickert = Complaint::count(); return view('admin.principal.index', compact('queryCountTotal', 'countTickert', 'countOfertas')); } else { $id_user = Auth::user()->id; $messageCount = AdvertMessage::where('id_user', $id_user)->count(); $queryCountUser = Advert::where('user_id', '=', $id_user)->count(); return view('admin.principal.index', compact('queryCountUser', 'messageCount', 'countOfertas')); } }