I have a slide show of images where the images registered in the bank appear. The table is called events . In this table there is a field called data_fim , which would refer to the end of the event date, and I also have a field called status , where it is of type boolean that when it is true it is active on the slide. What do I need for a service to listen, which, when the current date (date ('d')) is no longer equal to the date of the date_fim field it is disabled in the status == false field . How would you do such a feat? It was doing so see:
$evento = Evento::whereDay('data_fim', '<=' ,date('d'))->first();
if($evento){
$evento->status = false;
$evento->save();
}
More I think this is a lot of gambiarra. There is a smarter way to do the same. I would like to learn with services in Laravel. I do not know very well. I ask you to orient me.