Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/UserDiscount.php
Show All 31 Lines | class UserDiscount 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) { | ||||
return 1; | return 1; | ||||
} | } | ||||
$this->info("Found user {$user->id}"); | $this->info("Found user {$user->id}"); | ||||
if ($this->argument('discount') === '0') { | if ($this->argument('discount') === '0') { | ||||
$discount = null; | $discount = null; | ||||
} else { | } else { | ||||
$discount = \App\Discount::find($this->argument('discount')); | $discount = \App\Discount::withEnvTenant()->find($this->argument('discount')); | ||||
if (!$discount) { | if (!$discount) { | ||||
return 1; | return 1; | ||||
} | } | ||||
} | } | ||||
foreach ($user->wallets as $wallet) { | foreach ($user->wallets as $wallet) { | ||||
if (!$discount) { | if (!$discount) { | ||||
Show All 9 Lines |