Page MenuHomePhorge

WalletTransactions.php
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

WalletTransactions.php

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class WalletTransactions extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'wallet:transactions {--detail} {wallet}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'List the transactions against a wallet.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$wallet = \App\Wallet::where('id', $this->argument('wallet'))->first();
if (!$wallet) {
return 1;
}
foreach ($wallet->transactions()->orderBy('created_at')->get() as $transaction) {
$this->info(
sprintf(
"%s: %s %s",
$transaction->id,
$transaction->created_at,
$transaction->toString()
)
);
if ($this->option('detail')) {
$elements = \App\Transaction::where('transaction_id', $transaction->id)
->orderBy('created_at')->get();
foreach ($elements as $element) {
$this->info(
sprintf(
" + %s: %s",
$element->id,
$element->toString()
)
);
}
}
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Apr 24, 12:59 PM (1 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f0/43/2855f5d709227aafbc8987521bf8
Default Alt Text
WalletTransactions.php (1 KB)

Event Timeline