File: /var/www/vhost/disk-apps/agile-selling-wpb/app/Console/Commands/SyncB1OnDemand.php
<?php
namespace App\Console\Commands;
use DB;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
class SyncB1OnDemand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'b1:on-demand {command_execute} {database} {param1}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'B1 comando para sync a demanda';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{ $db = $this->argument("database");
$param1 = $this->argument("param1");
$command = $this->argument("command_execute");
// Reconnect to DB.
Config::set('database.default', $db);
DB::reconnect($db);
if($command == "b1:sync-inventory"){
$this->call($command, ["warehouse" => $param1]);
}else {
$this->call($command);
}
}
}