- show elements as table
This commit is contained in:
@@ -17,19 +17,28 @@ class ListCV extends Command
|
||||
public function handle(): int
|
||||
{
|
||||
$cvList = CV::all();
|
||||
$cvListCollection = [];
|
||||
|
||||
/** @var CV $cv */
|
||||
foreach ($cvList as $cv) {
|
||||
$resource = new CVResource($cv);
|
||||
$this->line('ID: '. $resource->id);
|
||||
$this->line('Token: '. $resource->token);
|
||||
$this->line('Company: '. $resource->recipient);
|
||||
$this->line('Phone: '. $resource->formattedPhoneNumber .', '. $resource->PhoneNumber);
|
||||
$this->line('Locations: '. implode(' / ', $resource->locations));
|
||||
$this->line('Views: '. $resource->views);
|
||||
$this->line('');
|
||||
$cvResource = (new CVResource($cv))->setAsConsole()->toArray();
|
||||
$cvListCollection[] = [
|
||||
'id' => $cvResource['id'],
|
||||
'token' => $cvResource['token'],
|
||||
'email' => $cvResource['email'],
|
||||
'recipient' => $cvResource['recipient'],
|
||||
'locations' => implode(' / ', $cvResource['locations']),
|
||||
'phone' => $cvResource['phone']['formattedPhoneNumber'],
|
||||
'views' => $cvResource['views'] . '/' . $cvResource['registeredViews'],
|
||||
];
|
||||
}
|
||||
|
||||
if (count($cvListCollection) > 0)
|
||||
$this->table(
|
||||
['Id', 'Token', 'E-mail', 'Company', 'Locations', 'Phone', 'Views'],
|
||||
$cvListCollection
|
||||
);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user