43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\CV;
|
|
use Illuminate\Console\Command;
|
|
|
|
class CVInfo extends Command
|
|
{
|
|
protected $signature = 'cv:info {id}';
|
|
|
|
protected $description = 'Show info about CV';
|
|
|
|
|
|
public function handle(): int
|
|
{
|
|
if (! ($cv = CV::find($id = $this->argument('id')))) {
|
|
$this->error('CV not found!');
|
|
return Command::FAILURE;
|
|
}
|
|
|
|
$this->line('ID: '. $cv->id);
|
|
$this->line('Token: '. $cv->token);
|
|
$this->line('Company: '. $cv->recipient);
|
|
$this->line('Phone: '. $cv->formattedPhoneNumber .', '. $cv->PhoneNumber);
|
|
$this->line('Locations: '. implode(' / ', $cv->locations));
|
|
$this->line('Views: '. $cv->views);
|
|
$this->line('');
|
|
|
|
$this->line('Showed list:');
|
|
foreach ($cv->info()->orderByDesc('id')->get() as $cvInfo) {
|
|
$this->line('ID: '. $cvInfo->id);
|
|
$this->line('IP: '. $cvInfo->ip);
|
|
$this->line('Date: '. $cvInfo->created_at->format('d-m-Y H:i:s'));
|
|
$this->line('');
|
|
}
|
|
|
|
return Command::SUCCESS;
|
|
}
|
|
}
|