laravel - Executing a Route (Controller/Action) using PHP CLI and Detecting a CLI Request -


is there way in laravel 4 run controller/action using php-cli? have controller/action extend perform alternative action if request comes cli, there way identify request cli request?

the laravel documentation on this site seems suggest there method request::cli() determining if current request via artisan cli when used method in laravel 4, throws error:

call undefined method illuminate\http\request::cli()

basically, have moved cakephp laravel , accomplish similar what's described in article (for cakephp) : calling controller actions cron , command line

i understand can work laravel 4 artisan commands, approach use possible? , if so, how?

as rob said, determine if current script being run in console use app::runninginconsole() or simple plain php php_sapi_name() == 'cli'.

as running controller@action console, use curl or wget request 1 of routes think proper way of doing use custom artisan command. controllers classes can instantiate them , use please within artisan command:

$controller = new somecontroller; $controller->someaction(); 

watch this video introduction developing own artisan commands.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -