I have created a query in SQL and it works quite well.
SELECT learning_content_number,
course,
count(required) as required,
count(overdue) as overdue,
count(status) as status,
count(completion_date) as completion_date
FROM hse_leatros
GROUP BY learning_content_number
Now I want to translate it in Laravel 8 Eloquent. This script works, but I am missing the information about the course.
$courses = Leatro::groupBy('learning_content_number')
->selectRaw('count(required) as required, learning_content_number')
->selectRaw('count(overdue) as overdue, learning_content_number')
->selectRaw('count(status) as status, learning_content_number')
->selectRaw('count(completion_date) as completion_date, learning_content_number')
->get();
How can I enter the in the code that it is transferred with?