Reputation: 99
I have DB and I need to change its status column after 30 days. that mean one data row(post) running 30 days live. after 30 days that data automatically disable. so what is the method to do that.
my DB columns
id
gender
description
status
created_at
EXP_Date
I need to generate EXP_date automatically.
created_at +30 days
after that
if current date = EXP_Date (how to setup query run without admin involving)
status column update as EXPIRED
so How I can do that. help me.
Upvotes: 0
Views: 281
Reputation: 141
You can use Laravel Task scheduling to run job daily check expire date.
Document: https://laravel.com/docs/6.x/scheduling
Step 1: Create a job for checking expire date.
Step 2: Add schedule job to app/Console/Kernel.php $schedule->job(new CheckExpire)->daily();
Step 3: Run schedule * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
Upvotes: 1