����JFIF��x�x����'
Server IP : 66.29.137.217 / Your IP : 3.147.68.89 Web Server : LiteSpeed System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : gltevjme ( 1095) PHP Version : 7.0.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/gltevjme/./cbt.bofirm.com/app/Console/Commands/ |
Upload File : |
<?php /** * File name: ExpireSchedules.php * Last modified: 18/07/21, 11:53 AM * Author: NearCraft - https://codecanyon.net/user/nearcraft * Copyright (c) 2021 */ namespace App\Console\Commands; use App\Models\ExamSchedule; use App\Models\QuizSchedule; use App\Settings\LocalizationSettings; use Carbon\Carbon; use Illuminate\Console\Command; class ExpireSchedules extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'expire:schedules'; /** * The console command description. * * @var string */ protected $description = 'Command to expire quiz/exam schedules after passing end date time'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return int */ public function handle() { $localization = app(LocalizationSettings::class); $now = Carbon::now()->timezone($localization->default_timezone); // fetch all the quiz schedules that passed end date $quizSchedules = QuizSchedule::where('end_date', '<=', $now->toDateString()) ->where('end_time', '<=', $now->toTimeString()) ->where('status', '=', 'active')->get(); //set status as expired foreach ($quizSchedules as $schedule) { $schedule->status = 'expired'; $schedule->update(); } // fetch all the exam schedules that passed end date $examSchedules = ExamSchedule::where('end_date', '<=', $now->toDateString()) ->where('end_time', '<=', $now->toTimeString()) ->where('status', '=', 'active')->get(); //set status as expired foreach ($examSchedules as $schedule) { $schedule->status = 'expired'; $schedule->update(); } return 1; } }