What I have done so far, but I thing i get the collection and not the value on "rating" value.
$user = User::where('id', $request->id)->with('lessons')->first();
$a = 1;
$collection = new Collection();
while ($a <= date('d')) {
$date = new Carbon(date('Y').date('m').$a);
$collection->push((object)['date' => $a,
'rating'=> $user->lesson->where('date', $date->toDateString())->first() ? $user->lesson->where('date', $date->toDateString())->first()->get('rating') : null
]);
$a++;
}