z-song/laravel-admin · error · InvalidArgumentException

Invalid model [{$this->model}]

Error message

Invalid model [{$this->model}]

What it means

Error "Invalid model [{$this->model}]" thrown in z-song/laravel-admin.

Source

Thrown at src/Grid/Selectable.php:145

    protected function appendRemoveBtn($hide = true)
    {
        $hide = $hide ? 'hide' : '';
        $key = $this->key;

        $this->column('__remove__', ' ')->display(function () use ($hide, $key) {
            return <<<BTN
<a href="javascript:void(0);" class="grid-row-remove {$hide}" data-key="{$this->getAttribute($key)}">
    <i class="fa fa-trash"></i>
</a>
BTN;
        });
    }

    protected function initGrid()
    {
        if (!class_exists($this->model) || !is_subclass_of($this->model, Model::class)) {
            throw new \InvalidArgumentException("Invalid model [{$this->model}]");
        }

        /** @var Model $model */
        $model = new $this->model();

        $this->grid = new Grid(new $model());

        if (!$this->key) {
            $this->key = $model->getKeyName();
        }
    }

    /**
     * @param string $method
     * @param array  $arguments
     *
     * @return mixed
     */

View on GitHub (pinned to 67c441eb78)

When it happens

Trigger: Thrown at src/Grid/Selectable.php:145 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/bc9d73164070b1e5. Report an issue: GitHub.