'my cron job is not working whats wrong in it
i apply a cron job where i want to update some values but my cron job is not working whats wrong in it here is my code in kernel.php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
$schedule->command('cron:update-user-not-new')->daily();
}
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
and it is console/commands UpdateUserNotNew.php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
public function handle()
{
Customer::whereDate('visit_date', '>', now()->addDays(1)->toDateTimeString())
->update([
'visit_clear' => 0
]);
}
here visit_date is stored in this form in db " 2020-08-21 10:17:00 "
Solution 1:[1]
you have to add a single entry to your server’s crontab file
-
-
-
-
- php /path/to/artisan schedule:run 1>> /dev/null 2>&1
-
-
-
OR
-
-
-
-
- cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
-
-
-
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ali Tariq |