gecche / laravel-multidomain

A Laravel extension for using a laravel application on a multi domain setting
MIT License
851 stars 107 forks source link

Scheduler + Command Question #87

Closed christoph-werker closed 2 years ago

christoph-werker commented 2 years ago

Hello,

i've a question regarding the Scheduler, Command workflow.

I use your package with multiple Domains in one project and that works like charm. Each domain has his own Scheduler, what I run from Laravel Forge like this: php /home/forge/DOMAIN/artisan schedule:run --domain=DOMAIN

In my Kernel i schedule all the commands that are triggered by the Domain Scheduler. $schedule->command('COM:MAND')->everyTwoMinutes(); <- No --Domain option Command: protected $signature = 'COM:MAND'; <- No --Domain option

In my tests, each Scheduler triggers all commands, but I have commands that are only used for single Domains. That is why i surround them with if(env('APP_URL') === 'DOMAIN') {}.

Is this the best practice Method? First is thought that I can filter the command by the --domain option with results in a mess.

Thanks for your Help.

gecche commented 2 years ago

Hi,

I think that your practice is fine, I only have 2 doubts:

1 - Command: protected $signature = 'COM:MAND'; <- No --Domain option What does it means? Using my package each command gets by default the domain option

2 - $schedule->command('COM:MAND')->everyTwoMinutes(); <- No --Domain option I'm not completely sure that you can safely omit the domain option in this point.

I close the issue: If you have some doubts feel free to repopen it.

Cheers,

Giacomo