I am working with laravel 5.6 and going to make task schedule to delete a records witch old than 15 days from now. so, I have CustomCommand.php file in app->Console->Commands folder and handle function is this,
public function handle()
{
$now = \Carbon\Carbon::now();
DB::table('vehicles')
->where('created_at', '<', $now->subDays(15))
->delete();
$this->info('All old advertisments are deleted sucessfully');
}
and My kernel.php is like this,
protected function schedule(Schedule $schedule)
{
$schedule->command('custom:command')->hourly();
}
but My vehicles table older than 15days records do not delete as shedule... how to fix this problem?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NahOdc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire