I have a Kernel script which runs to send an automated email out of Sales for the week.
Each tenant can configure what day of the week and what hour they choose to receive the email. This information is stored in a settings database for that tenant. Each tenant has a separate database with a separate settings table.
To work out "when" to send the email in the Kernel.php file I have been doing:
// Tenant A example
$WeeklyExecuteDay = "mondays"
$TimeToExecute = "05:00";
// Tenant B example
$WeeklyExecuteDay = "saturdays"
$TimeToExecute = "10:00";
This doesnt work though because Tenant A Day and Time might be different to Tenant B Day and Time.
Any suggestions how I can modify the Kernel script to allow for different tenants to execute the same script at different times?