z-song/laravel-admin · error · InvalidArgumentException

[Class [{$selectable}] must be a sub class of Encore\Admin\G

Error message

[Class [{$selectable}] must be a sub class of Encore\Admin\Grid\Selectable

What it means

Error "[Class [{$selectable}] must be a sub class of Encore\Admin\Grid\Selectable" thrown in z-song/laravel-admin.

Source

Thrown at src/Grid/Displayers/BelongsTo.php:40

    /**
     * @return mixed
     */
    protected function getOriginalData()
    {
        return $this->getColumn()->getOriginal();
    }

    /**
     * @param string $selectable
     * @param string $column
     *
     * @return string
     */
    public function display($selectable = null, $column = '')
    {
        if (!class_exists($selectable) || !is_subclass_of($selectable, Selectable::class)) {
            throw new \InvalidArgumentException(
                "[Class [{$selectable}] must be a sub class of Encore\Admin\Grid\Selectable"
            );
        }

        return Admin::component('admin::grid.inline-edit.belongsto', [
            'modal'     => sprintf('modal-grid-selector-%s', $this->getClassName()),
            'key'       => $this->getKey(),
            'original'  => $this->getOriginalData(),
            'value'     => $this->getValue(),
            'resource'  => $this->getResource(),
            'name'      => $column ?: $this->getName(),
            'relation'  => get_called_class(),
            'url'       => $this->getLoadUrl($selectable, get_called_class() == BelongsToMany::class),
        ]);
    }
}

View on GitHub (pinned to 67c441eb78)

When it happens

Trigger: Thrown at src/Grid/Displayers/BelongsTo.php:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of z-song/laravel-admin@67c441eb78 (2026-08-21). Data as JSON: /api/errors/67ac4d143af259e3. Report an issue: GitHub.