Filter

Filters allow you to manipulate and filter various things used in Voyager.

Layouts

Filter the available layouts for a given BREAD.

<?php

use Illuminate\Support\Collection;
use Voyager\Admin\Classes\Bread;
use Voyager\Admin\Contracts\Plugins\GenericPlugin;
use Voyager\Admin\Contracts\Plugins\Features\Filter\Layouts as LayoutFilter;

class MyPlugin implements GenericPlugin, LayoutFilter
{
    public function filterLayouts(Bread $bread, string $action, Collection $layouts): Collection
    {
        // $bread contains the BREAD class
        // $action can be either "browse", "read", "edit" or "add"

        return $layouts->filter(function ($layout) {
            // Add your conditions here
            return true;
        });
    }
}

Filter the shown menu-items.

Widgets

Filter the widgets shown on the dashboard

Media

Filter the shown files/directories in the media-manager

Last updated

Was this helpful?