Estado inicial: frontend React + backend Laravel
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Workshop;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
|
||||
class UpdateWorkshopStatus extends Command
|
||||
{
|
||||
protected $signature = 'workshops:update-status';
|
||||
protected $description = 'Atualiza o estado de workshops agendados para realizados se a data for menor que a data atual';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$update = Workshop::where(function($query){
|
||||
$query->where('date', '<', now()->toDateString())
|
||||
->orWhere(function($q){
|
||||
$q->where('date', '=', now()->toDateString())
|
||||
->where('time_end', '<', now()->toTimeString());
|
||||
});
|
||||
})
|
||||
->where('status', 'pending')
|
||||
->update(['status' => 'realized']);
|
||||
$this->info('Workshops atualizados com sucesso');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user