I am doing a cron in laravel with Schedule, but the date of the parameters for the execution of the cron are not fixed. I have a table that stores the data with which I will later use it as the parameters for cron execution. The problem is that I do not know how, from the controller at the time of writing to a record, I can send that record to the query I have in the kernel for cron.
Here is the function that is in the kernel:
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->hourly();
$schedule->call(function() {
$programacion =
DB::table('plantrabajoalerta')
->select(DB::raw('tareaFechaInicioPlanTrabajoAlerta, tareaHoraPlanTrabajoAlerta, tareaIntervaloPlanTrabajoAlerta, tareaDiaLaboralPlanTrabajoAlerta, tareaDiasPlanTrabajoAlerta, tareaMesesPlanTrabajoAlerta'))
->where('idPlanTrabajoAlerta',"=", $id)
->get();
$schedule->command('log:plantrabajo')->cron('minuto hora dia * * *');
});
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire