Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/User/AssignSkuCommand.php
- This file was moved from src/app/Console/Commands/UserAssignSku.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands\User; | ||||
use App\Console\Command; | use App\Console\Command; | ||||
class UserAssignSku extends Command | class AssignSkuCommand extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'user:assign-sku {user} {sku} {--qty=}'; | protected $signature = 'user:assign-sku {user} {sku} {--qty=}'; | ||||
Show All 9 Lines | class AssignSkuCommand extends Command | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = $this->getUser($this->argument('user')); | $user = $this->getUser($this->argument('user')); | ||||
if (!$user) { | if (!$user) { | ||||
$this->error("Unable to find the user {$this->argument('user')}."); | $this->error("User not found."); | ||||
return 1; | return 1; | ||||
} | } | ||||
$sku = $this->getObject(\App\Sku::class, $this->argument('sku'), 'title'); | $sku = $this->getObject(\App\Sku::class, $this->argument('sku'), 'title'); | ||||
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; | ||||
Show All 15 Lines |