Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/PackageSkus.php
Show All 22 Lines | class PackageSkus extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$packages = Package::withEnvTenant()->get(); | $packages = Package::withEnvTenantContext()->get(); | ||||
foreach ($packages as $package) { | foreach ($packages as $package) { | ||||
$this->info(sprintf("Package: %s", $package->title)); | $this->info(sprintf("Package: %s", $package->title)); | ||||
foreach ($package->skus as $sku) { | foreach ($package->skus as $sku) { | ||||
$this->info(sprintf(" SKU: %s (%d)", $sku->title, $sku->pivot->qty)); | $this->info(sprintf(" SKU: %s (%d)", $sku->title, $sku->pivot->qty)); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } |