laravel method to return distinct collection code example
Example 1: select distinct laravel
$items = DB::table('item')->select('item_name')->distinct()->get();
Example 2: eloquent get distinct
$ad->getcodes()->distinct('pid')->count('pid');
$items = DB::table('item')->select('item_name')->distinct()->get();
$ad->getcodes()->distinct('pid')->count('pid');