vendredi 18 août 2017

Laravel compare timestamps in where statement

I have a block of code in which I am passing a Carbon date that looks like this:

2017-08-18 22:53:50.031922

And want to compare it to created_at time stamps of some records. However, it seems that the records are not being filtered out; is the comparison in the where 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();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uYVrKL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire