title: Creating array in controller and passing to external function
body: <p>I'm trying to take existing/working code from a laravel controller and create an array of customers from an existing query function in that controller.</p>
  
  <p>Here is the controller code portion that works:</p>
  
  <p>CONTROLLER</p>
  
  <pre><code>$d-&gt;createdAt = new \DateTime($d-&gt;created_at);
  $deadline = Carbon::now()-&gt;subMonths(2);
  if($d-&gt;nextDate &lt;= $now &amp;&amp; $d-&gt;createdAt &gt; $deadline &amp;&amp; $d-&gt;status != 'exempt'){
      $d-&gt;status = 'priority';
  }
  </code></pre>
  
  <p>That block of code works by taking an existing query in the controller, querying the 'created_at' column in the database, and if it's within the last 6 months it applys a status of 'priority' which is used as a css class to highlight.</p>
  
  <p>That works perfectly.</p>
  
  <p>Now, I want to take any affected customer from that query ($d->custNum) with a status of 'priority', put it in an array and then pass the array to my function called findActive in my activeCust.php file</p>
  
  <p>activeCust.php</p>
  
  <pre><code>public function findActive($custNum){
  
      $sql ="
          SELECT c.customer
            FROM customers C
          WHERE c.customer NOT IN ($custNum)
      ";
  }
  </code></pre>
  
  <p>Basically, after that code block in the controller, I want to create an array of all returned customer numbers (i.e. the status of 'priority') and pass that array to the function so that I can say "Run this findActive query on any customer that isn't in this array".</p>
  
  <p>The idea here is extending the working code into a new file that does the same highlighting but works off of different logic. I'm just not sure the best way to create the array so that I can pass it into the function properly.</p>
  
  <p>How can I create an array from the returned values in the controller code block and use the array for my 'NOT IN' in the function query in activeCust.php?</p>