0
I’m using $this->validate()
to perform field validation in Laravel, how can I apply an underscore in the name of the fields automatically in the output of all messages referring to validation error?
I’m using Laravel 5.6
0
I’m using $this->validate()
to perform field validation in Laravel, how can I apply an underscore in the name of the fields automatically in the output of all messages referring to validation error?
I’m using Laravel 5.6
0
You can use the class OutputFormatterStyle
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>');
}
Place inside a model, and always use Handler to give the output you need to underline:
$class = new ClasseQueRepresentar();
$class->OutputHandler('algo');
Source: https://stillat.com/blog/2016/12/03/custom-command-styles-with-laravel-artisan
Browser other questions tagged laravel
You are not signed in. Login or sign up in order to post.