Vijay Kumar
Vijay Kumar

Reputation: 33

Update table after certain time in laravel

I'm new to laravel, I want to update a table status to active at certain time for eg: my table column date value '2019-03-20 12:10:00' when the time is crossed '2019-03-20 12:10:00' then status column has to be updated to active automatically. Please anyone provide me the solution.

Upvotes: 1

Views: 1164

Answers (1)

bhavinjr
bhavinjr

Reputation: 1763

You can define Task Scheduling

$schedule->command('auto:active')->dailyAt('12:10');

You can schudele command based on your logic. it will triggered 12:10 daily

Your command will look something like

class AutoActive extends Command
{
   protected $signature = 'auto:active';
   protected $description = 'your desc.....';

   public function handle()
   {
      // you can write your logic here
   }
}

For more info read: Scheduling artisan commands

Upvotes: 1

Related Questions