app/Http/Controllers/RemateVueController.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)
    {
        if (!$request->ajax()) return redirect('/');
        $buscar = $request->buscar;
        $criterio = $request->criterio;        
        if ($buscar==''){
            $remates = Remate::orderBy('id_remate', 'desc')->paginate(10);
        }
        else{
            $remates = remate::where($criterio, 'like', '%'. $buscar . '%')->orderBy('id', 'desc')->paginate(10);
        }       
        return [
            'pagination' => [
                'total'        => $remates->total(),
                'current_page' => $remates->currentPage(),
                'per_page'     => $remates->perPage(),
                'last_page'    => $remates->lastPage(),
                'from'         => $remates->firstItem(),
                'to'           => $remates->lastItem(),
            ],
            'remates' => $remates
        ];
    }
public function index ( Request $ request ) { if ( ! $ request -> ajax ( ) ) return redirect ( '/' ) ; $ buscar = $ request -> buscar ; $ criterio = $ request -> criterio ; if ( $ buscar == '' ) { $ remates = Remate :: orderBy ( 'id_remate' , 'desc' ) -> paginate ( 10 ) ; } else { $ remates = remate :: where ( $ criterio , 'like' , '%' . $ buscar . '%' ) -> orderBy ( 'id' , 'desc' ) -> paginate ( 10 ) ; } return [ 'pagination' => [ 'total' => $ remates -> total ( ) , 'current_page' => $ remates -> currentPage ( ) , 'per_page' => $ remates -> perPage ( ) , 'last_page' => $ remates -> lastPage ( ) , 'from' => $ remates -> firstItem ( ) , 'to' => $ remates -> lastItem ( ) , ] , 'remates' => $ remates ] ; }
Display a listing of the resource.
Display a listing of the resource .