Add InstanceService

This commit is contained in:
Daniel Supernault 2021-04-20 23:11:43 -06:00
parent 35393edfef
commit c20a9dfefe
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -0,0 +1,30 @@
<?php
namespace App\Services;
use Cache;
use App\Instance;
class InstanceService
{
public static function getBannedDomains()
{
return Cache::remember('instances:banned:domains', now()->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();
});
}
}