Page MenuHomePhorge

D4743.1775406819.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D4743.1775406819.diff

diff --git a/src/app/Console/Commands/CompanionApp/DeleteCommand.php b/src/app/Console/Commands/CompanionApp/DeleteCommand.php
new file mode 100644
--- /dev/null
+++ b/src/app/Console/Commands/CompanionApp/DeleteCommand.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Console\Commands\CompanionApp;
+
+use App\Console\ObjectDeleteCommand;
+
+class DeleteCommand extends ObjectDeleteCommand
+{
+ protected $dangerous = false;
+ protected $hidden = false;
+
+ protected $objectClass = \App\CompanionApp::class;
+ protected $objectName = 'companion-app';
+ protected $objectTitle = 'id';
+}
diff --git a/src/app/Console/Commands/CompanionApp/ListCommand.php b/src/app/Console/Commands/CompanionApp/ListCommand.php
new file mode 100644
--- /dev/null
+++ b/src/app/Console/Commands/CompanionApp/ListCommand.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Console\Commands\CompanionApp;
+
+use App\Console\Command;
+use App\CompanionApp;
+
+class ListCommand extends Command
+{
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'companion-app:list';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'List companion apps';
+
+ /**
+ * Execute the console command.
+ *
+ * @return mixed
+ */
+ public function handle()
+ {
+ $companionapps = CompanionApp::all();
+
+ $companionapps->each(
+ function ($companionapp) {
+ $this->info($companionapp->toJson(JSON_PRETTY_PRINT));
+ }
+ );
+ }
+}
diff --git a/src/app/Console/Commands/User/CompanionAppsCommand.php b/src/app/Console/Commands/User/CompanionAppsCommand.php
new file mode 100644
--- /dev/null
+++ b/src/app/Console/Commands/User/CompanionAppsCommand.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace App\Console\Commands\User;
+
+use App\Console\ObjectRelationListCommand;
+
+class CompanionAppsCommand extends ObjectRelationListCommand
+{
+ protected $objectClass = \App\User::class;
+ protected $objectName = 'user';
+ protected $objectTitle = 'email';
+ protected $objectRelation = 'companionApps';
+}
diff --git a/src/app/User.php b/src/app/User.php
--- a/src/app/User.php
+++ b/src/app/User.php
@@ -506,6 +506,16 @@
return $this->entitleables(SharedFolder::class, $with_accounts);
}
+ /**
+ * Return companion apps by the current user.
+ *
+ * @return \Illuminate\Database\Eloquent\Builder Query builder
+ */
+ public function companionApps()
+ {
+ return \App\CompanionApp::where('user_id', $this->id);
+ }
+
public function senderPolicyFrameworkWhitelist($clientName)
{
$setting = $this->getSetting('spf_whitelist');

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 5, 4:33 PM (1 d, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18833916
Default Alt Text
D4743.1775406819.diff (2 KB)

Event Timeline