How to convert this sql query to Eloquent ?
SELECT user_id, company_id, MAX(date) date
FROM careers
GROUP BY user_id, comapany_id;
`
How to convert this sql query to Eloquent ?
SELECT user_id, company_id, MAX(date) date
FROM careers
GROUP BY user_id, comapany_id;
`
For further actions, you may consider blocking this person and/or reporting abuse
Adams Adebayo -
Asfia Aiman -
Jerome Thayananthajothy -
Saddam Hossain -
Top comments (2)
I just made a tool just for this. You can use it for free:
jjlabajo.github.io/SQLtoEloquent/
$careers = Career::selectRaw('user_id, company_id, MAX(date) as date')->groupBy(['user_id','comapany_id'])->get();