In this laravel error solving tutorial, I will show you how to solve cannot access protected property Illuminate\Pagination\LengthAwarePaginator::$total. You know that, we can not access this protected property like that.
To access this property, you have to follow the below tricks. See the example:
$data = User::orderBy('created_at','desc')->paginate(5); $data = json_encode($data); $data = json_Decode($data); // now you can access all the protected property like.... dd($data->total);
Hope it can help you.