Aryan Aryan - 1 month ago 7
MySQL Question

Implement this mysql command in laravel eloquent

How to implement this

mysql
command in laravel eloquent ?

SELECT count(distinct(sender_id)) as responds FROM `messages` WHERE job_id=3

Answer

Do read the documentation thoroughly (RTFM!), it's all there, optionally open up API page.

You may try as:

Message::where('job_id','=',3)
        ->distinct()
        ->count();
Comments