z-song/laravel-admin · error · InvalidArgumentException
[$model] must be a valid model class
Error message
[$model] must be a valid model class
What it means
Error "[$model] must be a valid model class" thrown in z-song/laravel-admin.
Source
Thrown at src/Form/Field/Select.php:232
return $this;
}
/**
* Load options from current selected resource(s).
*
* @param string $model
* @param string $idField
* @param string $textField
*
* @return $this
*/
public function model($model, $idField = 'id', $textField = 'name')
{
if (!class_exists($model)
|| !in_array(Model::class, class_parents($model))
) {
throw new \InvalidArgumentException("[$model] must be a valid model class");
}
$this->options = function ($value) use ($model, $idField, $textField) {
if (empty($value)) {
return [];
}
$resources = [];
if (is_array($value)) {
if (Arr::isAssoc($value)) {
$resources[] = Arr::get($value, $idField);
} else {
$resources = array_column($value, $idField);
}
} else {
$resources[] = $value;
}View on GitHub (pinned to 67c441eb78)
When it happens
Trigger: Thrown at src/Form/Field/Select.php:232 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/5a5d002d40f5c316.
Report an issue: GitHub.