You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to implement this package if shop work on odd/even days of month ?
For example, shop opened on even days, but no matter what day it is (odd/even) the shop has Sunday off.
It's regular schedule for people like barber, masseur. They work 1 day and have 1 day off.
How to create this schedule and attach to shop to make queries ?
This will create object, but how to attach it to my shop instance ?
$openingHours = OpeningHours::create([
'monday' => ['09:00-12:00', '13:00-18:00'],
'tuesday' => ['09:00-12:00', '13:00-18:00'],
'wednesday' => ['09:00-12:00'],
'thursday' => ['09:00-12:00', '13:00-18:00'],
'friday' => ['09:00-12:00', '13:00-20:00'],
'saturday' => ['09:00-12:00', '13:00-16:00'],
'sunday' => [],
'exceptions' => [
'2016-11-11' => ['09:00-12:00'],
'2016-12-25' => [],
],
]);
The text was updated successfully, but these errors were encountered:
How to implement this package if shop work on odd/even days of month ?
Since this package is built around the concept that every week has regular opening hours, the odd/even days sets won't work out of the box. I'd suggest generating the array that will get passed to create—based on what day of the week is even or odd—and creating a new set every time you need to query it.
How to create this schedule and attach to shop to make queries ?
Do you mean storing opening hours in the database? In that case, I generally just store a json dump of the array that gets passed in to the create method in a row.
Good day!
For example, shop opened on even days, but no matter what day it is (odd/even) the shop has Sunday off.
It's regular schedule for people like barber, masseur. They work 1 day and have 1 day off.
This will create object, but how to attach it to my shop instance ?
$openingHours = OpeningHours::create([
'monday' => ['09:00-12:00', '13:00-18:00'],
'tuesday' => ['09:00-12:00', '13:00-18:00'],
'wednesday' => ['09:00-12:00'],
'thursday' => ['09:00-12:00', '13:00-18:00'],
'friday' => ['09:00-12:00', '13:00-20:00'],
'saturday' => ['09:00-12:00', '13:00-16:00'],
'sunday' => [],
'exceptions' => [
'2016-11-11' => ['09:00-12:00'],
'2016-12-25' => [],
],
]);
The text was updated successfully, but these errors were encountered: