How to Display Laravel DB Query
I will show you How to display the Laravel DB query. The simple method to see the query generated is by utilizing ->toSql() method. The second option is to listen for query events on the DB object.
$models = model::select(DB::raw('DISTINCT(family_group_no)'))->toSql();
print_r($models);
Output : select DISTINCT(family_group_no) from `families`
=== OR ===
dd($results->toSql(), $results->getBindings());