title: Yii2: How to send a variable from controller to modelSearch?
body: <p>I have a controller and I need to send a variable to my CarsSearch model but I got this error:</p>
  <pre><code>Invalid argument supplied for foreach()
  </code></pre>
  <p>The search will get cars sold on a certain date using the <code>$date</code>. How can I send the <code>$date</code> variable?</p>
  <p>This is my controller:</p>
  <pre><code>public function actionCars()
  {
      $date = '2020-06-01';
      $searchModel = new CarsSearch($date); // Poblem here in $date.
      $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
  
      return $this-&gt;render('cars', [
          'searchModel' =&gt; $searchModel,
          'dataProvider' =&gt; $dataProvider,
          'date' =&gt; $date,
      ]);
  }
  </code></pre>