{"record":{"id":"5a229aadb7dfd322","repo":"z-song/laravel-admin","slug":"column-of-this-field-must-be-a-belongstomany-rel","errorCode":null,"errorMessage":"Column of this field must be a `BelongsToMany` relation.","messagePattern":"Column of this field must be a `BelongsToMany` relation\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Grid/Displayers/BelongsToMany.php","lineNumber":42,"sourceCode":"    protected function getOtherKey()\n    {\n        if (isset(static::$otherKey[$this->getName()])) {\n            return static::$otherKey[$this->getName()];\n        }\n\n        $model = $this->getGrid()->model()->getOriginalModel();\n\n        if (is_callable([$model, $this->getName()]) &&\n            ($relation = $model->{$this->getName()}()) instanceof Relation\n        ) {\n            /* @var Relation $relation */\n            $fullKey = $relation->getQualifiedRelatedPivotKeyName();\n            $fullKeyArray = explode('.', $fullKey);\n\n            return static::$otherKey[$this->getName()] = end($fullKeyArray);\n        }\n\n        throw new \\Exception('Column of this field must be a `BelongsToMany` relation.');\n    }\n\n    /**\n     * @throws \\Exception\n     *\n     * @return false|string|void\n     */\n    protected function getOriginalData()\n    {\n        $relations = $this->getColumn()->getOriginal();\n\n        if (is_string($relations)) {\n            $data = explode(',', $relations);\n        }\n\n        if (!is_array($relations)) {\n            return;\n        }","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/z-song/laravel-admin/blob/67c441eb78ecc5437e59775d89770cd9c2cb1e05/src/Grid/Displayers/BelongsToMany.php#L24-L60","documentation":"Error \"Column of this field must be a `BelongsToMany` relation.\" thrown in z-song/laravel-admin.","triggerScenarios":"Thrown at src/Grid/Displayers/BelongsToMany.php:42 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"}