lundi 6 septembre 2021

Laravel Eloquent filter by MySQL Timestamp

I have a Laravel (5.2) Eloquent Model where the database field type is MySQL Timestamp and having values in Y-m-d H:i:s format,

I am wiring some Laravel Eloquent model as:

UserSubscription::where('renewal_date','<=',Carbon::now());

but when I print this using toSql() , the query print ? instead Carbon::now() value, I tried below options:

  1. Carbon::now('UTC') I already have timezone defined in my config file as UTC.

  2. Carbon::now()->format('Y-m-d H:i:s')

but nothing worked, where and what I am doing wrong..?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3kVX0Eh
via IFTTT

Aucun commentaire:

Enregistrer un commentaire