Skip to content

Instantly share code, notes, and snippets.

@thewinterwind
Last active Aug 29, 2015
Embed
What would you like to do?
Artisan Files for Streak Counting Tutorial (2 files combined here)
// this is /app/start/artisan.php
<?php
/*
|--------------------------------------------------------------------------
| Register The Artisan Commands
|--------------------------------------------------------------------------
|
| Each available Artisan command must be registered with the console so
| that it is available to be called. We'll register every command so
| the console gets access to each of the command object instances.
|
*/
Artisan::add(new UpdateStreaks);
// this is /app/commands/UpdateStreaks.php
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class UpdateStreaks extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'ss:update-streaks';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update the stock streaks';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
(new StoringController)->store_streaks();
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('example', InputArgument::OPTIONAL, 'An example argument.'),
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment