Quick filters (tags)

You're browsing the documentation for an old version of MoonShine. Consider upgrading your project to MoonShine 2.x.

Sometimes you may need to create a set of filters (collection of results) and display it in the listing. Tags have been created for these cases.

namespace MoonShine\Resources;
use MoonShine\Models\MoonshineUser;
use MoonShine\QueryTags\QueryTag;
use Illuminate\Contracts\Database\Eloquent\Builder;
class PostResource extends Resource
public static string $model = App\Models\Post::class;
public static string $title = 'Articles';
public function queryTags(): array
return [
'Post with author', // Tag Title
fn(Builder $query) => $query->whereNotNull('author_id') // Query builder
'Post without an author',
fn(Builder $query) => $query->whereNull('author_id')