Laravel-admin: Method hasGetMutator does not exist

Created on 15 Jul 2017  ·  8Comments  ·  Source: z-song/laravel-admin

Method Encore\Admin\Grid::__toString() must not throw an exception, caught ErrorException: Method hasGetMutator does not exist. (View: E:\xampp\htdocs\alkamal\resources\viewsvendor\admin\grid\table.blade.php)

Most helpful comment

Try to run artisan view:clear

All 8 comments

这是什么原因,能说明一下吗,我最新版的碰到了这个问题

"encore/laravel-admin": "1.6.10" 遇到同样的问题

Try to remove from your grid/table.blade.php layout @if ( $grid->allowTools() ) condition. It worked for me

remove $grid->showTools(), It worked for me

Try to run artisan view:clear

我也出现这个问题,请问有谁解决没有

@lizhufei 运行一下artisan view:clear, 如果无效,检查一下你是否自定义过视图,内置视图每个版本都有可能会更新,对比一下出现问题的视图文件

我也遇到了同样的问题,提示如下:

Method Illuminate\Database\Eloquent\Collection::hasGetMutator does not exist.

debug了好久发现是上一个grid字段定义冲突导致的
$grid->build('Build');这个字段在Grid类里面已经定义了,用于build Grid,但是我的模型字段里面也出现了 build,所以就导致后面的一个字段在操作的时候 里面的 model 参数变化了,因为已经 build 过了。

当我将 $grid->build('Build'); 改成 $grid->column('build'); 报错就解决了。

所以这里有个坑的地方,建议在 controller 的 grid 里的内容的时候判断下 方法是否存在,存在的话换成 column 的方式。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

taimaiduc picture taimaiduc  ·  3Comments

vlongen picture vlongen  ·  3Comments

clock1129 picture clock1129  ·  3Comments

evans-kim picture evans-kim  ·  3Comments

cdhraesaemer picture cdhraesaemer  ·  3Comments