41 lines
1.1 KiB
PHP
41 lines
1.1 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}';
|
|
|
|
protected $description = 'Create CV';
|
|
|
|
public function handle(): int
|
|
{
|
|
$recipient = $this->argument('recipient');
|
|
$email = $this->argument('email');
|
|
$phone = $this->argument('phone');
|
|
$locations = $this->argument('location');
|
|
|
|
CV::query()
|
|
->create([
|
|
// 'slug' => Str::ra,
|
|
'recipient' => $recipient,
|
|
'email' => $email,
|
|
'phone-number' => $phone,
|
|
'locations' => $locations,
|
|
]);
|
|
|
|
return CommandAlias::SUCCESS;
|
|
}
|
|
}
|