49 lines
		
	
	
		
			1011 B
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1011 B
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Console\Commands;
 | |
| 
 | |
| use Illuminate\Console\Command;
 | |
| use Illuminate\Support\Facades\Queue;
 | |
| 
 | |
| class JobRun extends Command
 | |
| {
 | |
|     /**
 | |
|      * The name and signature of the console command.
 | |
|      *
 | |
|      * @var string
 | |
|      */
 | |
|     protected $signature = 'job:run {--count=1}';
 | |
| 
 | |
|     /**
 | |
|      * The console command description.
 | |
|      *
 | |
|      * @var string
 | |
|      */
 | |
|     protected $description = '';
 | |
| 
 | |
|     /**
 | |
|      * Execute the console command.
 | |
|      *
 | |
|      * @return int
 | |
|      */
 | |
|     public function handle()
 | |
|     {
 | |
|         $count = $this->option('count');
 | |
|         if (!is_numeric($count)) {
 | |
|             $count = 1;
 | |
|         }
 | |
| 
 | |
|         $this->output->title('count: ' . $count);
 | |
|         for ($i = 1; $i <= $count; $i++) {
 | |
|             Queue::connection('rabbitmq')
 | |
|                 ->push(
 | |
|                     job: 'not_laravel',
 | |
|                     queue: 'puppeteer',
 | |
|                     data: [
 | |
|                         'url' => env('PUPPETEER_URL'),
 | |
|                     ],
 | |
|                 );
 | |
|         }
 | |
|     }
 | |
| }
 |