Page MenuHomePhorge

D5772.1775244547.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D5772.1775244547.diff

diff --git a/src/app/Console/Commands/User/CreateDelegationCommand.php b/src/app/Console/Commands/User/CreateDelegationCommand.php
new file mode 100644
--- /dev/null
+++ b/src/app/Console/Commands/User/CreateDelegationCommand.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace App\Console\Commands\User;
+
+use App\Console\Command;
+use App\Delegation;
+use Carbon\Carbon;
+
+class CreateDelegationCommand extends Command
+{
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'user:create-delegation {delegator} {delegatee}';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Create delegation for user.';
+
+ /**
+ * Execute the console command.
+ *
+ * @return mixed
+ */
+ public function handle()
+ {
+ $delegator = $this->getUser($this->argument('delegator'), true);
+ $delegatee = $this->getUser($this->argument('delegatee'), true);
+
+ $delegation = new Delegation();
+ $delegation->user_id = $delegator->id;
+ $delegation->delegatee_id = $delegatee->id;
+ $delegation->save();
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 7:29 PM (7 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826004
Default Alt Text
D5772.1775244547.diff (1 KB)

Event Timeline