Exemplo n.º 1
1
 public function guardar_baners(Request $request)
 {
     //	dd($request->all());
     //	dd($request->hasFile('baner1'));
     $ruta = base_path();
     $ruta = $ruta . '/../www/img/';
     //dd($ruta);
     if (Input::hasFile('baner1')) {
         Input::file('baner1')->move($ruta, 'baner1.jpg');
         $guardar = baner::find(1);
         //dd($guardar->link);
         $guardar->link = $request->Input('link1');
         $guardar->save();
         # code...
     }
     if (Input::hasFile('baner2')) {
         Input::file('baner2')->move($ruta, 'baner2.jpg');
         $guardar = baner::findOrFail(2);
         //dd($guardar);
         $guardar->link = $request->input('link2');
         $guardar->save();
         # code...
     }
     if (Input::hasFile('baner3')) {
         Input::file('baner3')->move($ruta, 'baner3.jpg');
         $guardar = baner::findOrFail(3);
         //dd($guardar);
         $guardar->link = $request->input('link3');
         $guardar->save();
         # code...
     }
     if (Input::hasFile('baner4')) {
         Input::file('baner4')->move($ruta, 'baner4.jpg');
         $guardar = baner::findOrFail(4);
         //dd($guardar);
         $guardar->link = $request->input('link4');
         $guardar->save();
         # code...
     }
     return redirect()->route('backend.dashboard')->withFlashSuccess("Baners actualizados.");
 }
Exemplo n.º 2
0
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $productos_all = productos::with('user')->where('deleted_at', null)->get()->shuffle();
     $baner = rand(1, 4);
     $link = baner::findOrFail($baner);
     //dd($link);
     $productos_all = $productos_all->take(20);
     $productos_patrocinados = productos::where('patrocinado', '>', 0)->where('deleted_at', null)->orderBy('updated_at', 'desc')->take(4)->get()->shuffle();
     return view('frontend.index')->with('productos', $productos_all)->with('patrocinados', $productos_patrocinados)->with('baner', $baner)->with('link', $link->link);
 }