I want to filter data based on it's date_diff (6days) with status of trial = 1 for each rows then pass it as an array using eloquent method. Thanks!
Function:
public function checkTrialUser(){
$trialuser = Staff::select(DB::raw('unix_timestamp(NOW()) - unix_timestamp(created_at) AS time_diff'))
->where('trial',1)
->get();
Log::info('this is a output',$trialuser);
}
Database table:
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| first_name | varchar(255) | NO | | NULL | |
| last_name | varchar(255) | NO | | NULL | |
| email | varchar(255) | NO | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
| last_login | timestamp | YES | | NULL | |
| trial | tinyint(4) | NO | | NULL | |
+------------+--------------+------+-----+---------+----------------+
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire