I want to have unique mounths in SELECT. I find out i have to use GROUP BY. But it doesnt work this way:
@foreach($months as $month)
<option value="{{ $month->id }}">{{ Carbon\Carbon::parse($month
->date)
->format(' F ')
->groupBy('date') }}</option>
@endforeach
How to use groupBy in this way? Because it looks like this right now without GROUP BY:
My Laravel Controller:
public function index()
{
$users = User::all(['name', 'id']);
$months = RouteInfo::all(['date', 'id']);
return view('admin.index', compact('users', $users, 'months', $months));
}
Thank you for your help