Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $show = PhoneShow::find($id);
     if ($show) {
         $show->delete();
     }
     return redirect()->back();
 }