Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odd/even days #40

Closed
sergiybutenko opened this issue Mar 20, 2017 · 1 comment
Closed

odd/even days #40

sergiybutenko opened this issue Mar 20, 2017 · 1 comment

Comments

@sergiybutenko
Copy link

sergiybutenko commented Mar 20, 2017

Good day!

  1. 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.
  2. 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' => [],
    ],
    ]);
@sebastiandedeyne
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants