I don't understand what you need. What is the problem ?
Jun 4, 2022
7
Level 4
Carbon week starts at Sunday globally
I have middleware where I'm setting locale:
if (something)
Carbon::setlocale('fr');
if (something)
Carbon::setlocale('en');
And I want also set start of the week at Sunday, no matter current locale (now EN starts Sunday and FR starts Monday).
I found this, but it is deprecated and I can't figure out to use suggested solutions:
// deprecated
Carbon::setWeekStartsAt(Carbon::MONDAY);
// error message
@deprecated To avoid conflict between different third-party libraries, static setters should not be used.
* Use $weekEndsAt optional parameter instead when using endOfWeek method. You can also use the
* 'first_day_of_week' locale setting to change the start of week according to current locale
* selected and implicitly the end of week.
Please or to participate in this conversation.