app/Http/Controllers/EventoController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index(Request $request)
    {
        $q = $request->input('search');
        $user = Evento::select('eventos.id', 'nombre_evento', 'lugar', 'fecha', 'hora', 'estado', 'tipo', 'descripcion', 'nombre')->leftJoin('categoria', 'eventos.tipo', '=', 'categoria.id')->where( 'nombre_evento', 'LIKE', '%' . $q . '%' )->orderBy('eventos.id', 'desc')->paginate (10)->setPath ( '' );
            $pagination = $user->appends ( array (
                'search' => $request->input('search')
                ) );
        return $user;
    }
public function index ( Request $ request ) { $ q = $ request -> input ( 'search' ) ; $ user = Evento :: select ( 'eventos.id' , 'nombre_evento' , 'lugar' , 'fecha' , 'hora' , 'estado' , 'tipo' , 'descripcion' , 'nombre' ) -> leftJoin ( 'categoria' , 'eventos.tipo' , '=' , 'categoria.id' ) -> where ( 'nombre_evento' , 'LIKE' , '%' . $ q . '%' ) -> orderBy ( 'eventos.id' , 'desc' ) -> paginate ( 10 ) -> setPath ( '' ) ; $ pagination = $ user -> appends ( array ( 'search' => $ request -> input ( 'search' ) ) ) ; return $ user ; }
Display a listing of the resource.
Display a listing of the resource .
//return Evento::all(); /*$eventos = DB::table('eventos')->paginate(10);
        return $eventos;*/ /*if($q != "")
        { 
            $user = Evento::where ( 'nombre_evento', 'LIKE', '%' . $q . '%' )->paginate (10)->setPath ( '' );
            $pagination = $user->appends ( array (
                'q' => $request->input('q')
                ) );
        }*/