Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117751897
D1564.1775187192.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D1564.1775187192.diff
View Options
diff --git a/src/app/Console/Commands/WalletAddTransaction.php b/src/app/Console/Commands/WalletAddTransaction.php
new file mode 100644
--- /dev/null
+++ b/src/app/Console/Commands/WalletAddTransaction.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class WalletAddTransaction extends Command
+{
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'wallet:add-transaction {wallet} {qty} {--message=}';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Add a transaction to 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::find($this->argument('wallet'));
+
+ if (!$wallet) {
+ return 1;
+ }
+
+ $qty = (int) $this->argument('qty');
+
+ $message = $this->option('message');
+
+ if ($qty < 0) {
+ $wallet->debit($qty, $message);
+ } else {
+ $wallet->credit($qty, $message);
+ }
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 3:33 AM (22 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18794352
Default Alt Text
D1564.1775187192.diff (1 KB)
Attached To
Mode
D1564: Provide a means to add transactions to wallets with messages
Attached
Detach File
Event Timeline