<?php
|
|
|
|
namespace App\Helpers;
|
|
|
|
/**
|
|
*
|
|
*
|
|
*
|
|
*/
|
|
class TerminalHelper
|
|
{
|
|
/**
|
|
*
|
|
* @param [type] $menu [description]
|
|
* @param [type] $messages [description]
|
|
* @param string $text [description]
|
|
* @return [type] [description]
|
|
*/
|
|
public function confirmArray($menu, $messages, $text = 'Ok', $field = NULL)
|
|
{
|
|
foreach($messages as $key => $message) {
|
|
if (is_array($message)) {
|
|
$this->confirmArray($menu, $message, $text, $key);
|
|
} else {
|
|
|
|
// reset prefix
|
|
$prefix = '';
|
|
|
|
// if field is not null, add prefix
|
|
if ($field) {
|
|
$prefix = $field.' ';
|
|
}
|
|
|
|
// adding confirm message
|
|
$menu->confirm($prefix.$message)->display($text);
|
|
}
|
|
}
|
|
}
|
|
}
|