jeudi 28 juillet 2016

filter laravel collection by date

In the code given below $allZip["assigned_date"] has value 2016-07-27 18:12:26 ,when I try to compare it with created_at field which is timestamp field as well,the result is empty collection.

$filtered_datas = $datas->filter(function ($data) use($allZip) {

            return $data->zip == $allZip["zip"] && $data->created_at < $allZip["assigned_date"];

        });

There is data in database with zip field matching value from $allZip["zip"] and created_at field with value 2016-07-19 18:12:26,so it should return one item in collection but returns empty collection instead,why ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire