herkese selamlar bir cronjob olayı yaptım ama yemedi malesef yardımlarınızı bekliyorum.
aşağıdaki kernel.php kodlarım.
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//Commands\Inspire::class,
Commands\DeleteProduct::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('delete:cron')
->everyMinute();
}
}
<?php
namespace App\Console\Commands;
use DB;
use Carbon\Carbon;
use Illuminate\Console\Command;
class DeleteProduct extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'delete:cron';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
DB::table('products')->where('ending_time' , Carbon::now() )->delete();
}
}
Amacım eğer ürünün bitiş tarihi bugune eşit ise o kaydın silinmesi ama olmadı nedendir acaba ? yardımlarınız için şimdiden teşekkürler.