Forum Eloquent Comparing Dates in Where Clause (Twist: date stored at string)
I've got a model that has a column: date_revoked (this is stored as a string)
After this date is passed, a user is no longer supposed to be able to access a certain page.
I'd like to restrict this access in the controller.
Currently, I can do a janky partial fix by putting this inside of a foreach in my view
@if(strtotime($filmShareIn->date_revoked) >= strtotime(date('Y-m-d')))
But when I try the following in the controller, I get no filtering:
->where('date_revoked', '>=', Carbon::now())
I know I may have really just screwed up by storing it as a string, but if anyone can get me out of this jam, it is my friends at Laracasts.
Thanks!
Please sign in or create an account to participate in this conversation.
There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything!
Get Started
Comparing Dates in Where Clause (Twist: date stored at string)
I've got a model that has a column: date_revoked (this is stored as a string)
After this date is passed, a user is no longer supposed to be able to access a certain page.
I'd like to restrict this access in the controller.
Currently, I can do a janky partial fix by putting this inside of a foreach in my view
But when I try the following in the controller, I get no filtering:
I know I may have really just screwed up by storing it as a string, but if anyone can get me out of this jam, it is my friends at Laracasts.
Thanks!