Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/UserAssignSku.php
Show All 21 Lines | class UserAssignSku extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = \App\User::where('email', $this->argument('user'))->first(); | $user = \App\User::withEnvTenant()->where('email', $this->argument('user'))->first(); | ||||
if (!$user) { | if (!$user) { | ||||
$this->error("Unable to find the user {$this->argument('user')}."); | $this->error("Unable to find the user {$this->argument('user')}."); | ||||
return 1; | return 1; | ||||
} | } | ||||
$sku = \App\Sku::find($this->argument('sku')); | $sku = \App\Sku::withEnvTenant()->find($this->argument('sku')); | ||||
if (!$sku) { | if (!$sku) { | ||||
$sku = \App\Sku::where('title', $this->argument('sku'))->first(); | $sku = \App\Sku::withEnvTenant()->where('title', $this->argument('sku'))->first(); | ||||
} | } | ||||
if (!$sku) { | if (!$sku) { | ||||
$this->error("Unable to find the SKU {$this->argument('sku')}."); | $this->error("Unable to find the SKU {$this->argument('sku')}."); | ||||
return 1; | return 1; | ||||
} | } | ||||
$quantity = (int) $this->option('qty'); | $quantity = (int) $this->option('qty'); | ||||
Show All 12 Lines |