0

I have the schedule which calls everyMinute one type of company, but now I have a company table and different parameters for schedule. For instance: Google - calls every 5 minutes, Twitter - calls every 15 minutes etc.

  $schedule->call(function () {
            $service = new Service();
            $companies = Company::all();
            $service->get($companies);
        })->everyMinute();

So how can I redo this? Can I do something like this?

$companies = Company::all();
  foreach($companies as $company) {
       $schedule->call(function () {
            $service = new Service();
            $service->get($company);
        })->$companyTime();
  }

Will it work for every company with own settings? P.S. I can not check it because It does not work locally. Thank you!

Aleks
  • 147
  • 10

1 Answers1

0

If your project works locally, you can check it without a cron set. Just run this command locally in the terminal / console and let it run.

php artisan schedule:run
Martin Osusky
  • 820
  • 1
  • 6
  • 15