Fetch distinct value in laravel

Friends, many times there is such data inside the database which keeps repeating multiple times and what we need is that we need only unique answers from them, I am running a restaurant, in this I have some special ones which are repeating but I have to show them in the menu bar.

And I want to show only one direction in navigation and not its repeated value, so how can I use in Laravel to get unique data on such condition, let’s discuss below:

$data = DB::table('service_templates')->distinct()->get(['category']);
$brands = DB::table('car_comparision')->get()->unique('brand');

 

Leave a Reply