Fix usage_broadband, since our usage data is a float
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
|
||||
use App\Jobs\BroadbandTraffic as Job;
|
||||
use App\Models\Supplier;
|
||||
@@ -15,7 +16,7 @@ class BroadbandTraffic extends Command
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'broadband:traffic:import'.
|
||||
' {--s|supplier= : Supplier Name}';
|
||||
' {supplier? : Supplier Name}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -31,14 +32,26 @@ class BroadbandTraffic extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ($this->option('supplier')) {
|
||||
$o = Supplier::where('name','ilike',$this->option('supplier'))->singleOrFail();
|
||||
if ($this->argument('supplier')) {
|
||||
try {
|
||||
$o = Supplier::active()
|
||||
->where('name','ilike',$this->argument('supplier'))
|
||||
->sole();
|
||||
|
||||
Job::dispatchSync($o->id);
|
||||
return;
|
||||
} catch (ModelNotFoundException $e) {
|
||||
$this->error(sprintf('Supplier [%s] not found',$this->argument('supplier')));
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
Job::dispatchSync($o->name);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
foreach (Supplier::active()->get() as $o)
|
||||
Job::dispatchSync($o->id);
|
||||
Job::dispatchSync($o->name);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user