samedi 25 mars 2017

Coloured Output To Console Outside Commands in Laravel 5.4

inside Command i can output

$this->error();
$this->info();

but if i instantiate other classes inside Command - how do i make coloured output to console inside that external classes? That other classes does not extend Command class.

I have found only this solution, and i don't like it :)

<?php

use Illuminate\Console\Command;

class External
{
    /** @var Command */
    protected $command;

    public function __construct(Command $command) {
        $this->command = $command;
    }

    protected function error($msg)
    {
        $this->command->error($msg);
    }

    protected function info($msg, $v = null)
    {
        $this->command->info($msg, $v);
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mC2jgV
via IFTTT

Aucun commentaire:

Enregistrer un commentaire