Query Date <=

I’m trying to query a date < or = today’s date in my search model but it’s not working. This is my code:




$today = date('Y-m-d');

$query = LiveJobs::find()

->where(['current_status' => ['Order Placed', 'Order Ready', 'Rejected']])

->where("order_eta <= '$today'")



I used to do this way on yii 1.1 but for 2 doesn’t work




$today = date('Y-m-d');

		

		$criteria = new CDbCriteria;

		$criteria->select = "*";

		$criteria->condition = "DATE(order_eta) <= '$today' AND (t.current_status = 'order placed' OR t.current_status = 'Order Placed' OR t.current_status = 'order ready' OR t.current_status = 'Order Ready' OR t.current_status = 'Rejected')";

		$jobs = Job::model()->count($criteria);



Here is my solution:


LiveJobs::find()->where('order_eta<=:toDay', [':toDay' => $today])->all();