Re-use query instead of calling it again

This commit is contained in:
RMartinOscar 2025-11-06 22:54:03 +00:00
parent 56739b6150
commit 598e3e1401

View File

@ -27,11 +27,12 @@ class ListPlugins extends ListRecords
];
foreach (PluginCategory::cases() as $category) {
$query = Plugin::whereCategory($category->value);
$tabs[$category->value] = Tab::make($category->value)
->label($category->getLabel())
->icon($category->getIcon())
->badge(Plugin::whereCategory($category->value)->count())
->modifyQueryUsing(fn ($query) => $query->whereCategory($category->value));
->badge($query->count())
->modifyQueryUsing(fn () => $query);
}
return $tabs;