- show elements as table
This commit is contained in:
		| @@ -26,19 +26,30 @@ class CVInfo extends Command | ||||
|         $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('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('Rodo: '. (is_null($rodo = $cv->rodo) ? 'domyślne' : $rodo)); | ||||
|         $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(''); | ||||
|         $listCVInfo = []; | ||||
|         foreach (($cvInfoList = $cv->info()->orderByDesc('id')->get(['id', 'ip', 'created_at'])) as $cvInfo) { | ||||
|             $listCVInfo[] = [ | ||||
|                 'id' => $cvInfo->id, | ||||
|                 '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; | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user