Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117778114
D5772.1775244547.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
D5772.1775244547.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5772: Create delegation command
Attached
Detach File
Event Timeline