From c20a9dfefe8ccefda47dc9d4598c4560140cd3e6 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 20 Apr 2021 23:11:43 -0600 Subject: [PATCH] Add InstanceService --- app/Services/InstanceService.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/Services/InstanceService.php diff --git a/app/Services/InstanceService.php b/app/Services/InstanceService.php new file mode 100644 index 000000000..8b504d77f --- /dev/null +++ b/app/Services/InstanceService.php @@ -0,0 +1,30 @@ +addHours(12), function() { + return Instance::whereBanned(true)->pluck('domain')->toArray(); + }); + } + + public static function getUnlistedDomains() + { + return Cache::remember('instances:unlisted:domains', now()->addHours(12), function() { + return Instance::whereUnlisted(true)->pluck('domain')->toArray(); + }); + } + + public static function getNsfwDomains() + { + return Cache::remember('instances:auto_cw:domains', now()->addHours(12), function() { + return Instance::whereAutoCw(true)->pluck('domain')->toArray(); + }); + } +}