0

How to pass data from a cron job to a controller in Laravel?

We have a Laravel command called WordOfTheHour. In it I am connection to the database and pick a random word from a table with 9,500 records. How to pass this data from the cron to the controller?

Should it be some kind of POST request?

Emmanuel-Ab
  • 321
  • 2
  • 15
  • here is a good example to your question: https://stackoverflow.com/questions/28866821/call-laravel-controller-via-command-line – nakov Nov 17 '18 at 21:08

1 Answers1

1

Example:

$result = app('App\Http\Controllers\UserCtrl')->login($param1, $param2...);
  • "UserCtrl" is the controller
  • "login" is the method in that controller
  • "$param1", "$param2" are the parameters of that method.
Baraa Al-Tabbaa
  • 753
  • 5
  • 11