- show elements as table
This commit is contained in:
parent
f500c8691f
commit
58003e5d18
@ -26,19 +26,30 @@ class CVInfo extends Command
|
|||||||
$this->line('Company: '. $cv->recipient);
|
$this->line('Company: '. $cv->recipient);
|
||||||
$this->line('Phone: '. $cv->formattedPhoneNumber .', '. $cv->PhoneNumber);
|
$this->line('Phone: '. $cv->formattedPhoneNumber .', '. $cv->PhoneNumber);
|
||||||
$this->line('Locations: '. implode(' / ', $cv->locations));
|
$this->line('Locations: '. implode(' / ', $cv->locations));
|
||||||
$this->line('Views: '. $cv->views);
|
$this->line('Actual views: '. $cv->info()->select('id')->get()->count());
|
||||||
|
$this->line('Registered views: '. $cv->views);
|
||||||
$this->line('Mission: '. (is_null($mission = $cv->mission) ? 'domyślne' : $mission));
|
$this->line('Mission: '. (is_null($mission = $cv->mission) ? 'domyślne' : $mission));
|
||||||
$this->line('Rodo: '. (is_null($rodo = $cv->rodo) ? 'domyślne' : $rodo));
|
$this->line('Rodo: '. (is_null($rodo = $cv->rodo) ? 'domyślne' : $rodo));
|
||||||
$this->line('');
|
$this->line('');
|
||||||
|
|
||||||
$this->line('Showed list:');
|
$this->line('Showed list:');
|
||||||
foreach ($cv->info()->orderByDesc('id')->get() as $cvInfo) {
|
$listCVInfo = [];
|
||||||
$this->line('ID: '. $cvInfo->id);
|
foreach (($cvInfoList = $cv->info()->orderByDesc('id')->get(['id', 'ip', 'created_at'])) as $cvInfo) {
|
||||||
$this->line('IP: '. $cvInfo->ip);
|
$listCVInfo[] = [
|
||||||
$this->line('Date: '. $cvInfo->created_at->format('d-m-Y H:i:s'));
|
'id' => $cvInfo->id,
|
||||||
$this->line('');
|
'ip' => $cvInfo->ip,
|
||||||
|
'created' => $cvInfo->created_at->format('d-m-Y H:i:s'),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($cvInfoList->count() === 0)
|
||||||
|
$this->warn('Empty!');
|
||||||
|
else
|
||||||
|
$this->table(
|
||||||
|
['Id', 'IP', 'Showed'],
|
||||||
|
$listCVInfo,
|
||||||
|
);
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,19 +17,28 @@ class ListCV extends Command
|
|||||||
public function handle(): int
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$cvList = CV::all();
|
$cvList = CV::all();
|
||||||
|
$cvListCollection = [];
|
||||||
|
|
||||||
/** @var CV $cv */
|
/** @var CV $cv */
|
||||||
foreach ($cvList as $cv) {
|
foreach ($cvList as $cv) {
|
||||||
$resource = new CVResource($cv);
|
$cvResource = (new CVResource($cv))->setAsConsole()->toArray();
|
||||||
$this->line('ID: '. $resource->id);
|
$cvListCollection[] = [
|
||||||
$this->line('Token: '. $resource->token);
|
'id' => $cvResource['id'],
|
||||||
$this->line('Company: '. $resource->recipient);
|
'token' => $cvResource['token'],
|
||||||
$this->line('Phone: '. $resource->formattedPhoneNumber .', '. $resource->PhoneNumber);
|
'email' => $cvResource['email'],
|
||||||
$this->line('Locations: '. implode(' / ', $resource->locations));
|
'recipient' => $cvResource['recipient'],
|
||||||
$this->line('Views: '. $resource->views);
|
'locations' => implode(' / ', $cvResource['locations']),
|
||||||
$this->line('');
|
'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;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user