I have an object so i want to know how can get data from object.Object example is given below
return $response= PowerConsumption::groupBY('device_id')
->selectRaw('round(sum(unit),4) as yAxis,device_id')
->where('created_at',Carbon::now())->paginate(1);
So this eloquent query create given data,but i need current_page and please don't change my query.Only help me to figure out current_page value from this response.
{
total: 2,
per_page: 1,
current_page: 1,
last_page: 2,
next_page_url: "http://localhost:8000/graph/monthly/user_id/2?page=2",
prev_page_url: null,
from: 1,
to: 1,
data: [
{
yAxis: 222.8572,
device_id: 1
}
]
}
This data is store in $response variable and i need only current_page and last_page so how can i get. i'm trying this like
$response['current_page']; //it's return null
$response->current_page; //it's return error like
Undefined property: Illuminate\Pagination\LengthAwarePaginator::$current_page
Kindly help me in getting data