working on very old existing database, there are records are stored with UNIX timestamp an integer format like below structure
id | name | email | datetime
---------------------------------------
1 | abc | abc@example.com | 1277812531
2 | xyz | xyz@example.com | 1277862176
3 | pqr | pqr@example.com | 1277926058
4 | wxy | wxy@example.com | 1278348102
5 | nnn | nnn@example.com | 1278381032
Now, I want to lumen query if datetime is equals to pass by argument to get records
The project use lumen 5.7, and one of the main problems is, that the database store the timestamp as UNIX timestamp in an integer column and not as timestamp column. And I'm searching for the best way to handle this.
DB raw query and it works fine
$response = Model::where(\DB::raw('DATE_FORMAT(FROM_UNIXTIME(datetime), "%Y-%m-%d")'), '=', $_search_date)->get();
this is works for me :)