Laravel compare timestamps in where statement -


i have block of code in passing carbon date looks this:

2017-08-18 22:53:50.031922 

and want compare created_at time stamps of records. however, seems records not being filtered out; comparison in statement valid?

$test = auth::user()->tests()->with([     'participants.testrecords' => function ($query) use ($latestcapture) {         $query->select('id', 'score', 'test_id', 'participant_id', 'capture_timestamp', 'score', 'created_at');         $query->where('test_records.created_at', '>', $latestcapture); }])->findorfail($id)->toarray(); 

if $latestcapture instancej carbon, should rather use here:

$latestcapture->todatetimestring() 

to make sure pass valid date string.

there 1 more thing - should make sure created_at filled in php , not in mysql (this default in laravel) - if it's not can expect time shifts when have different time zones in php , mysql


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -