问题描述
我是Nova的新手。我正面临这个问题,模型具有一个字段名称徽标,并且存在一个具有相同名称getlogoAttributue()的访问器。 Nova抛出的错误
未定义索引:徽标
@H_404_5@该产品已经开发,并且大多数型号使用相同的约定。如果我开始更改型号,则会影响整个产品。如何在不更改型号的情况下使其与nova兼容。 以下是我的代码
模型
class Developer extends Model { /** * Developers associated with an agent */ protected $table = 'someDeveloperTable'; protected $primaryKey = 'id'; protected $appends = ['id','status','name','logo','overview','phone']; protected $visible = ['id','phone','cell','email','address','contact_person']; public function getlogoAttribute() { return $this->logo; } } **NovaResource**
class Developer extends Resource { public static $group = 'New Projects Management'; /** * The model the resource corresponds to. * * @var string */ public static $model = \App\Developer::class; /** * The single value that should be used to represent the resource when being displayed. * * @var string */ public static $title = 'company_name'; /** * The columns that should be searched. * * @var array */ public static $search = [ 'company_name',]; /** * Get the fields displayed by the resource. * * @param \Illuminate\Http\Request $request * @return array */ public function fields(Request $request) { return [ ID::make()->sortable() ->exceptOnForms(),Text::make('Company Title','company_name'),Text::make('Contact Pereson','contact_person'),Text::make('Description','developer_description'),Image::make('logo','logo') ->disk('s3public') ->path('listing-images') ->disableDownload() ->preview(function ($value) { return $value ? config('app.images_base_url') . "/$value?auto=compress&w=400" : null; }) ->thumbnail(function ($value) { return $value ? config('app.images_base_url') . "/$value?auto=compress&w=50" : null; }),]; }
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)