34 lines
		
	
	
		
			829 B
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			829 B
		
	
	
	
		
			PHP
		
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Console\Commands;
 | 
						|
 | 
						|
use App\Jobs\CheckUserAttendanceJob;
 | 
						|
use Illuminate\Console\Command;
 | 
						|
 | 
						|
class CheckUserAttendanceCommand extends Command
 | 
						|
{
 | 
						|
    // Định nghĩa command signature
 | 
						|
    protected $signature = 'attendance:check {period?}';
 | 
						|
    protected $description = 'Kiểm tra check in và check out của người dùng và tạo ticket nếu thiếu';
 | 
						|
 | 
						|
    /**
 | 
						|
     * Create a new command instance.
 | 
						|
     */
 | 
						|
    public function __construct()
 | 
						|
    {
 | 
						|
        parent::__construct();
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Execute the console command.
 | 
						|
     */
 | 
						|
    public function handle()
 | 
						|
    {
 | 
						|
        // Lấy argument period (Sáng "S" hoặc Chiều "C")
 | 
						|
        $period = $this->argument('period');
 | 
						|
 | 
						|
        // Dispatch job để kiểm tra check in và check out
 | 
						|
        CheckUserAttendanceJob::dispatch($period);
 | 
						|
    }
 | 
						|
}
 |