@deron
To get distinct rows in Laravel, you can use the distinct()
method in your query.
Here is an example:
1 2 3 4 |
$distinctRows = DB::table('users') ->select('name') ->distinct() ->get(); |
This query will return only distinct rows of the name
column from the users
table. You can modify the select()
and distinct()
methods according to your requirements to get distinct rows based on specific columns.