/** * Show the application welcome screen to the user. * * @return Response */ public function index() { $renders = []; $renders['adverts'] = AdminAdvert::orderBy('level', 'ASC')->get(); $dataAll = PhoneShow::orderBy('level', 'ASC')->get(); $total = count($dataAll); $i = 0; foreach ($dataAll as $data) { $i++; if ($i == $total) { array_push($this->item, $data); array_push($this->dataAll, $this->item); } else { if (count($this->item)) { array_push($this->item, $data); array_push($this->dataAll, $this->item); $this->item = []; } else { array_push($this->item, $data); } } } $renders['products'] = $this->dataAll; return view('home.index.show')->withDatas($renders); }
public function advertShow() { return view('admin.advert.index')->withAdverts(AdminAdvert::orderBy('level', 'ASC')->paginate(10)); }