Answer the question
In order to leave comments, you need to log in
How to display all rows whose date in the period falls on the current one?
Please help with a MYSQL query on Laravel 4.2
In the table, the user has the start date of access to the site, and the end date of access to the site.
How to correctly display all users who today NOW () have access to the site.
just came up with this:
SELECT
users_potok.id_user,
potok.datastart,
potok.dataend,
users_potok.id_potok
FROM users_potok
INNER JOIN potok
ON potok.ids = users_potok.id_potok
WHERE potok.datastart <= NOW()
AND potok.dataend >= NOW()
Answer the question
In order to leave comments, you need to log in
I don’t know how in 4.2, but in 5 you can make a mutator, getStatusAttribute (){...} in which they check that today's date is between them and return true / false, and this attribute is appended to the model collection
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question