How to make an inquiry to hours in laravel?

0

I have a database more or less like this

---------------------------------
| inicio   | fin     |    dato  |
---------------------------------
|   14:00  |  18:30  |    A     |
---------------------------------
|   19:00  |  23:30  |    B     |
---------------------------------
|   07:15  |  12:00  |    C     |
---------------------------------

Later I have the current time for example 15:23 , that hour is in the range of 14:00 - 18:30 - A which is the data I want to obtain.

I have the following:

Dato::where("inicio",">=",Carbon::now()->toTimeString())->where("fin","<=",Carbon::now()->toTimeString())->get();

But it does not work for me.

    
asked by Shassain 17.10.2018 в 21:40
source

0 answers