Merge pull request #2676 from Roardom/fix-all-pluck

(Refactor) Reduce unnecessary collection calls
This commit is contained in:
HDVinnie
2023-04-08 20:49:21 -04:00
committed by GitHub
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ class AutoHighspeedTag extends Command
*/
public function handle(): void
{
$seedboxIps = Seedbox::all()->pluck('ip')->filter(fn ($ip) => filter_var($ip, FILTER_VALIDATE_IP));
$seedboxIps = Seedbox::pluck('ip')->filter(fn ($ip) => filter_var($ip, FILTER_VALIDATE_IP));
Torrent::withAnyStatus()
->leftJoinSub(
+1 -1
View File
@@ -177,7 +177,7 @@ class AnnounceController extends Controller
), new TrackerException(121));
// Block Blacklisted Clients
$clientBlacklist = cache()->rememberForever('client_blacklist', fn () => BlacklistClient::all()->pluck('name')->toArray());
$clientBlacklist = cache()->rememberForever('client_blacklist', fn () => BlacklistClient::pluck('name')->toArray());
throw_if(
\in_array($userAgent, $clientBlacklist),
new TrackerException(128, [':ua' => $request->header('User-Agent')])
@@ -53,7 +53,7 @@ class GroupController extends Controller
{
$group = Group::create(['slug' => Str::slug($request->name)] + $request->validated());
foreach (Forum::all()->pluck('id') as $collection) {
foreach (Forum::pluck('id') as $collection) {
$permission = new Permission();
$permission->forum_id = $collection;
$permission->group_id = $group->id;