Created
February 15, 2013 05:08
-
-
Save winglian/4958665 to your computer and use it in GitHub Desktop.
RouteCommand for L4 that mimics the L3 version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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