Skip to content

Instantly share code, notes, and snippets.

@winglian
Created February 15, 2013 05:08
Show Gist options
  • Save winglian/4958665 to your computer and use it in GitHub Desktop.
Save winglian/4958665 to your computer and use it in GitHub Desktop.
RouteCommand for L4 that mimics the L3 version
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class RouteCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'route:call';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$request = Illuminate\Http\Request::create($this->argument('uri'), $this->argument('method'));
App::instance('request', $request);
App::run();
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('method', InputArgument::REQUIRED, 'HTTP Request Method'),
array('uri', InputArgument::REQUIRED, 'HTTP Request URI'),
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment