master
cody 2 weeks ago
parent d4ebd80800
commit aa5bf5fd2c

@ -0,0 +1,64 @@
<?php
namespace App\Console\Commands;
use App\Jobs\SendCourseDoor;
use App\Models\Course;
use App\Models\CourseSign;
use App\Models\User;
use App\Notifications\AuditNotify;
use App\Notifications\BirthdayNotify;
use App\Repositories\MeetRepository;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Notification;
class UpdateCourseSignDoor extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update_course_sign_door';
/**
* The console command description.
*
* @var string
*/
protected $description = '批量更新学员的门禁权限';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$courses = Course::where('status', 1)
->whereIn('id', [97, 99])
->get();
foreach ($courses as $course) {
$courseSigns = CourseSign::where('course_id', $course->id)->where('status', 1)->get();
foreach ($courseSigns as $courseSign) {
dispatch((new SendCourseDoor($courseSign)));
$this->info('更新学员' . $courseSign->user->name . '的门禁权限');
}
}
return $this->info('更新完成');
}
}
Loading…
Cancel
Save