0

我的 Ardent 模型有这样的 has_one 关系

public static $relationsData = array(
'organization'  => array(self::HAS_ONE, 'Organization', 'foreignKey' => 'party_id'),
);

现在,我的 Laravel Administrator 包的模型配置文件有这样的列配置

'columns' => array(
'id',
'organization' => array(
    'title' => "Organization",
    'relationship' => 'organization', //this is the name of the Eloquent relationship method!
    'select' => "(:table).organization_name",
),
'address' 
),

现在,它正在抛出这样的错误

已达到“100”的最大函数嵌套级别,正在中止!打开:C:\xampp\htdocs\hrms\vendor\laravel\framework\src\Illuminate\Support\Str.php

* Convert a value to studly caps case.
*
* @param  string  $value
* @return string
*/
public static function studly($value)
{
    $value = ucwords(str_replace(array('-', '_'), ' ', $value));

return str_replace(' ', '', $value);
4

1 回答 1

0

(我在这里回答了这个问题,现在我只是为了名声而嫖娼!)

使用问题#418中@bobiasg给出的解决方案,我能够解决该错误。这是在 Administrator/DataTable/Columns/Relationships/BelongsTo.php:71

//if the model method doesn't exist for any of the pieces along the way, exit out
if ((!method_exists($models[$i], $rel) && !is_callable(array($models[$i], $rel))) || !is_a($models[$i]->{$rel}(), self::BELONGS_TO))
{
    throw new \InvalidArgumentException("The '" . $this->getOption('column_name') . "' column in your " . $this->config->getOption('name') .
        " model configuration needs to be either a belongsTo relationship method name or a sequence of them connected with a '.'");
}
于 2014-11-15T02:08:50.840 回答