52 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| declare(strict_types=1);
 | |
| 
 | |
| namespace App\Console\Commands;
 | |
| 
 | |
| use App\Models\CV;
 | |
| use Illuminate\Console\Command;
 | |
| use Illuminate\Support\Str;
 | |
| use Symfony\Component\Console\Command\Command as CommandAlias;
 | |
| 
 | |
| class CreateCV extends Command
 | |
| {
 | |
|     protected $signature = 'cv:create
 | |
|                             {recipient : Company}
 | |
|                             {email : E-mail address}
 | |
|                             {phone : Phone number - with spaces}
 | |
|                             {location?* : List of locations}
 | |
|                             {--mission= : Description of mission}
 | |
|                             {--rodo= : Description of rodo}
 | |
|                             {--position= : Set position value}';
 | |
| 
 | |
|     protected $description = 'Create CV';
 | |
| 
 | |
|     public function handle(): int
 | |
|     {
 | |
|         $recipient = $this->argument('recipient');
 | |
|         $email = $this->argument('email');
 | |
|         $phone = $this->argument('phone');
 | |
|         $locations = $this->argument('location');
 | |
|         $mission = $this->option('mission');
 | |
|         $rodo = $this->option('rodo');
 | |
|         $position = $this->option('position');
 | |
| 
 | |
|         CV::query()
 | |
|             ->create([
 | |
|                 'token' => Str::random(50),
 | |
|                 'recipient' => $recipient,
 | |
|                 'email' => $email,
 | |
|                 'phone_number' => $phone,
 | |
|                 'locations' => $locations,
 | |
|                 'mission' => $mission,
 | |
|                 'rodo' => $rodo,
 | |
|                 'position' => $position,
 | |
|             ]);
 | |
| 
 | |
|         $this->info('Created!');
 | |
| 
 | |
|         return CommandAlias::SUCCESS;
 | |
|     }
 | |
| }
 |