I'm using $this->validate()
to perform field validation in Laravel, how can I automatically underline the field name in the output of all valid validation error messages?
I'm using Laravel 5.6
I'm using $this->validate()
to perform field validation in Laravel, how can I automatically underline the field name in the output of all valid validation error messages?
I'm using Laravel 5.6
You can use the OutputFormatterStyle
class and the methods getFormatter
and setStyle
Example:
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
// ...
function OutputHandler($sua_ saida)
{
$style = new OutputFormatterStyle('white', array('underscore'));
$this->command->output->getFormatter()->setStyle('underscored', $style);
$this->command->output->writeln('<underscored>'.$sua_ saida.'</underscored>');
}
Put it inside a model, and always use the handler to give the output you need to put the underline:
$class = new ClasseQueRepresentar();
$class->OutputHandler('algo');
Source: link