2016-06-06 2 views
0

도우미 클래스를 실행하는 콘솔 명령이 있는데 도우시 클래스에서 콘솔에 $this->info() 출력을 쓰고 싶습니다.도우미 클래스에서 콘솔에 출력을 작성하십시오.

내 코드는 다음과 같습니다 도우미에서 콘솔에 출력을 쓸 수있는 방법이

App/Http/Console/Commands/SomeCommand.php

function handle(Helper $helper) 
{ 
    return $helper->somefunction(); 
} 

App/Http/SomeHelper.php

function somefunction() 
{ 
    //some code 
    $this->info('send to console'); 
} 

있습니까? 나는 시도하지 않은

+0

에 따라 작성 SomeCommand.php file.For에 $this->info('send to console');이 작성해야합니다. –

답변

-1

,하지만 어쩌면 : $this->line("sent to console');

1

당신은 당신이를 분명히 \ 콘솔 \ 명령을 확장 할 경우 출력은 어쩌면이 https://laravel.com/docs/5.2/artisan#writing-output

+0

나는 그것이 작동한다는 것을 알고 있지만 헬퍼로부터도 출력해야합니다. – Alex

+1

@Alex SomeCommand 인스턴스를 만들고 $ this 대신 해당 객체를 사용 해보십시오. –

관련 문제