Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rizqidjamaluddin/4dad656104c638398b88 to your computer and use it in GitHub Desktop.
Save rizqidjamaluddin/4dad656104c638398b88 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Console\Command;
class AddUncategorizedCategoryCommand extends Command
{
protected $name = 'appname:generate:categories';
protected $description = 'Generate default item categories.';
/**
* @var ItemCategoriesService
*/
private $itemCategoriesService;
public function __construct(ItemCategoriesService $itemCategoriesService)
{
parent::__construct();;
$this->itemCategoriesService = $itemCategoriesService;
}
public function fire()
{
$this->info('Adding default item categories ...');
$this->itemCategoriesService->createNewIfMissing('Uncategorized');
$this->info('Done.');
}
protected function getArguments()
{
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