I'd like to get month index from month name using Carbon.
But I use Turkish month names.
I pass a query string to index like this ?ay=Temmuz&yıl=2017
so carbon should give 7 in this case.
The relevant part in my index function is like this:
public function index()
{
$gonderiler = Gonderi::latest();
if ($ay = request('ay'))
{
Carbon::setLocale(config('app.locale'));
$gonderiler->whereMonth('created_at', Carbon::parse($ay)->month);
}
if ($yil = request('yil'))
{
$gonderiler->whereYear('created_at', $yil);
}
/ ... /
}
When I click side bar and pass this query string it gives an error message like that:
"DateTime::__construct(): Failed to parse time string (Temmuz) at position 0 (T): The timezone could not be found in the database"