title: Laravel 9 - task scheduler controller function
body: <p>Hello i'm looking on how to execute a controller function with a cronjob. I've read the documentation but it doesn't explain on how to call a controller function.</p>
  <p>I have this function:</p>
  <pre><code>    function oracle(Request $request)  
  {
      // some get-insert statements using DB Facade
  }
  </code></pre>
  <p>Let's say i want to run this function every 10 minutes for each db record that has status = 0</p>
  <p>then in laravel scheduler something like:</p>
  <pre><code>     $schedule-&gt;call(function () {
         //.. DB query to check all orders that have status = 0
         //.. for each record that returns 0
         //.. execute oracle()
         }
      })-&gt;everyMinute();
  </code></pre>
  <p>Basically all orders with status 0 are on mysql, now the oracle() logic triggers on a manual click. This function gets data from mysql and inserts to the oracle database. Once the record is on oracle it returns status 1 to mysql. I have to do this with a cron.</p>
  <p>Which way should i go for?</p>