I want to convert mysql it to laravel code
SELECT *,AVG(number_star) FROM rates GROUP BY user_be_rate_id
I tried but they didn't work
Rate::all()->groupBy('user_be_rate_id')->avg('number_star');
or
Rate::->avg('number_star')->groupBy('user_be_rate_id');