@php ($user = $profile->user_id)@php
$user = $profile->user_id
@endphp $ratings = DB::table('ratings')
->selectSub(function ($query) {
return $query->selectRaw('SUM(ecology)');
}, 'ecology')
->selectSub(function ($query) {
return $query->selectRaw('SUM(social_protection)');
}, 'social_protection')
->where('point', 'test')
->get();