oc-social-plugin/console/SocialSync.php

62 lines
1.3 KiB
PHP

<?php namespace Zoomyboy\Social\Console;
use Illuminate\Console\Command;
use Storage;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Zoomyboy\Social\Classes\FacebookSyncService;
use Zoomyboy\Social\Models\Setting;
class SocialSync extends Command
{
/**
* @var string The console command name.
*/
protected $name = 'social:sync';
/**
* @var string The console command description.
*/
protected $description = 'Synchs social posts';
/**
* Execute the console command.
* @return void
*/
public function handle()
{
if ($this->option('clear', false)) {
return FacebookSyncService::clearAll();
}
if ($this->option('full', false)) {
FacebookSyncService::clearAll();
FacebookSyncService::syncAll();
return;
}
return FacebookSyncService::syncAll();
}
/**
* Get the console command arguments.
* @return array
*/
protected function getArguments()
{
return [];
}
/**
* Get the console command options.
* @return array
*/
protected function getOptions()
{
return [
['clear'],
['full']
];
}
}