Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120836434
TransactionsCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
TransactionsCommand.php
View Options
<?php
namespace
App\Console\Commands\Wallet
;
use
App\Console\Command
;
class
TransactionsCommand
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'wallet:transactions {--detail} {--balance} {wallet}'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'List the transactions against a wallet.'
;
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
$wallet
=
$this
->
getWallet
(
$this
->
argument
(
'wallet'
));
if
(!
$wallet
)
{
$this
->
error
(
"Wallet not found."
);
return
1
;
}
$withDetail
=
$this
->
option
(
'detail'
);
$balanceMode
=
$this
->
option
(
'balance'
);
$balance
=
0
;
$transactions
=
$wallet
->
transactions
()->
orderBy
(
'created_at'
)->
cursor
();
foreach
(
$transactions
as
$transaction
)
{
$balance
+=
$transaction
->
amount
;
$this
->
info
(
sprintf
(
"%s: %s %s"
,
$transaction
->
id
,
$transaction
->
created_at
,
$transaction
->
toString
()
)
.
(
$balanceMode
?
sprintf
(
' (balance: %s)'
,
$wallet
->
money
(
$balance
))
:
''
)
);
if
(
$withDetail
)
{
$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
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 1:30 PM (16 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18818007
Default Alt Text
TransactionsCommand.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline