Skip to content
Advertisement

Use a boolean function to determine the results in Laravel query builder

I have shops that open at a specific time and close at a specific time and I want to filter these stores according to a time period specified by the user so that all the returned shops will be available (opened) at any moment within filtering interval

The shop opens at 10 pm and closes at 2 pm, I mean the shop opens at 10 pm and closes the next day at 2 Pm

I think this is doing the job properly

JavaScript

I combined the two days on a range (0 to 48 hours) and tested if the shop that open in the first day or open in the second day (the first day + 24 hours)

But I want to use this function to fetch records from database using Laravel.

Can I pass a some function in the WHERE statement in Query Builder to decided it?, Or what is the way to do it?

Advertisement

Answer

Edited my answer after your last comment.

Assuming you can write your C++ function in PHP.

JavaScript
JavaScript

I hope it will help you a bit at least!

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement