Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/UserEntitlements.php
Show All 35 Lines | class UserEntitlements extends Command | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = User::where('email', $this->argument('userid'))->first(); | $user = User::where('email', $this->argument('userid'))->first(); | ||||
if (!$user) { | |||||
return 1; | |||||
} | |||||
$this->info("Found user: {$user->id}"); | $this->info("Found user: {$user->id}"); | ||||
$skus_counted = []; | $skus_counted = []; | ||||
foreach ($user->entitlements as $entitlement) { | foreach ($user->entitlements as $entitlement) { | ||||
if (!array_key_exists($entitlement->sku_id, $skus_counted)) { | if (!array_key_exists($entitlement->sku_id, $skus_counted)) { | ||||
$skus_counted[$entitlement->sku_id] = 1; | $skus_counted[$entitlement->sku_id] = 1; | ||||
} else { | } else { | ||||
Show All 10 Lines |