Page MenuHomePhorge

SkusCommand.php
No OneTemporary

Authored By
Unknown
Size
857 B
Referenced Files
None
Subscribers
None

SkusCommand.php

<?php
namespace App\Console\Commands\Package;
use App\Console\Command;
use App\Package;
class SkusCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'package:skus';
/**
* The console command description.
*
* @var string
*/
protected $description = "List SKUs for packages.";
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$packages = Package::withEnvTenantContext()->get();
foreach ($packages as $package) {
$this->info(sprintf("Package: %s", $package->title));
foreach ($package->skus as $sku) {
$this->info(sprintf(" SKU: %s (%d)", $sku->title, $sku->pivot->qty));
}
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Apr 24, 10:04 AM (5 d, 2 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18869871
Default Alt Text
SkusCommand.php (857 B)

Event Timeline