[Vuejs]-Having pagination issue in Vue / Laravel

0๐Ÿ‘

โœ…

You should change the line

this.estates = response.data;

to

this.estates = response.data.data;

0๐Ÿ‘

$data = \DB::table('allestates')->paginate(5);
    $response = [
        'pagination' => [
            'total' => $data->total(),
            'per_page' => $data->perPage(),
            'current_page' => $data->currentPage(),
            'last_page' => $data->lastPage(),
            'from' => $data->firstItem(),
            'to' => $data->lastItem()
        ],
        'data' => $data
    ];
    return response()->json($response);

Leave a comment