Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/Wallet/GetDiscountCommand.php
- This file was moved from src/app/Console/Commands/WalletGetDiscount.php.
<?php | <?php | ||||
namespace App\Console\Commands; | namespace App\Console\Commands\Wallet; | ||||
use App\Console\Command; | use App\Console\Command; | ||||
class WalletGetDiscount extends Command | class GetDiscountCommand extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'wallet:get-discount {wallet}'; | protected $signature = 'wallet:get-discount {wallet}'; | ||||
Show All 9 Lines | class GetDiscountCommand extends Command | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$wallet = $this->getWallet($this->argument('wallet')); | $wallet = $this->getWallet($this->argument('wallet')); | ||||
if (!$wallet) { | if (!$wallet) { | ||||
$this->error("Wallet not found."); | |||||
return 1; | return 1; | ||||
} | } | ||||
if (!$wallet->discount) { | if (!$wallet->discount) { | ||||
$this->info("No discount on this wallet."); | $this->info("No discount on this wallet."); | ||||
return 0; | return 0; | ||||
} | } | ||||
$this->info($wallet->discount->discount); | $this->info($wallet->discount->discount); | ||||
} | } | ||||
} | } |