You will need to define a Schedule of Laravel, it is very simple to use and configure, just follow the documentation that will not have any problem. but I will leave an example for you:
It stays inside of App\Console\Kernel.php;
protected function schedule(Schedule $schedule)
{
$schedule->command('tesouro:extrato')
->weekdays()
->hourly()
->between('10:00', '13:00');
}
In this example I am running the command tesouro:extrato
all the
weekdays every 1 hour from 10 am to 13 pm.
Now to your case,
What you can do, create a method that when called it checks the current system time and compares with the time of the posting table, if current time is longer than the posting hours and the posted status is still fake, it sends these results, the logic to do this and simple.
It would only be to search, the records not yet published based on the current time, go through them and publish, at the time it is published update the record table so that that post is marked as published.
Set the recurrence that wants to execute this method and ready, (here would enter the Schedule)
I recommend starting with the posting method, as you are still learning, focus on the most laborious part, so at last you do the Schedule.
I hope to give you at least a basis for how to proceed.
Do you have a table with the times of publication, ? in this table has the condition to verify if it has already been published ? knows the Scheduler of Laravel ?
– Bulfaitelo
@Bulfaitelo the table has the times of publication and validation. I’m still studying the Standard did not know the Scheduler
– Luana
I will try to answer in a way that mounts an environment that you can use, so you can have the basis to set up this schedule, ta bom
– Bulfaitelo
Okay, thank you very much! I will start reading about the Scheduler of Laravel also
– Luana