vendredi 31 août 2018

laravel task scheduler deleting a post

I setup a simple task scheduler in laravel everything works only problem that i am having is that the post is not deleting at the time i set. I want the post to delete after 5 minutes since the post was created at, not sure why my posts are deleting after a minute.I believe i want my task scheduler to check after every minute because each post has a different delete time. here my scheduler:

protected function schedule(Schedule $schedule)
{


    $schedule->call(function (){
    $post=    Post::where('created_at', '<', Carbon::now()->addMinutes(5))->delete();
    })->everyMinute();
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire