{"record":{"id":"f33b86bcd8643257","repo":"z-song/laravel-admin","slug":"model-must-be-a-valid-model-class-f33b86","errorCode":null,"errorMessage":"[$model] must be a valid model class","messagePattern":"\\[\\$model\\] must be a valid model class","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Grid/Filter/Presenter/Select.php","lineNumber":118,"sourceCode":"\n        return is_array($this->options) ? $this->options : [];\n    }\n\n    /**\n     * Load options from current selected resource(s).\n     *\n     * @param string $model\n     * @param string $idField\n     * @param string $textField\n     *\n     * @return $this\n     */\n    public function model($model, $idField = 'id', $textField = 'name')\n    {\n        if (!class_exists($model)\n            || !in_array(Model::class, class_parents($model))\n        ) {\n            throw new \\InvalidArgumentException(\"[$model] must be a valid model class\");\n        }\n\n        $this->options = function ($value) use ($model, $idField, $textField) {\n            if (empty($value)) {\n                return [];\n            }\n\n            $resources = [];\n\n            if (is_array($value)) {\n                if (Arr::isAssoc($value)) {\n                    $resources[] = Arr::get($value, $idField);\n                } else {\n                    $resources = array_column($value, $idField);\n                }\n            } else {\n                $resources[] = $value;\n            }","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/src/Grid/Filter/Presenter/Select.php#L100-L136","documentation":"Error \"[$model] must be a valid model class\" thrown in z-song/laravel-admin.","triggerScenarios":"Thrown at src/Grid/Filter/Presenter/Select.php:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"67c441eb78ecc5437e59775d89770cd9c2cb1e05","analyzedAt":"2026-08-21T02:51:03.143Z","schemaVersion":2},"datasetVersion":"2026-08-21T03:17:12.404Z"}