【发布时间】:2021-01-10 01:10:21
【问题描述】:
我对此Laravel nova action - get current model instance on fields()有类似的问题
但有来自https://github.com/laravel/nova-issues/issues/1813的信息
有可能。
我使用 Laravel 7.x 和 nova 3.10
我有一个带有“大小”字段的资源,例如 3KG、4KG
我对(仅在索引行)字段“金额”(数字字段)进行了操作
我希望用户只能将“大小”的乘积放入“金额”和显示在“大小”操作值上的字段
我在行动领域尝试过:
Text::make(__('Package'), 'size')
->default(function(){
//need to load value of current model resource "size" to inform user
})
->readonly(),
Number::make(__('Amount'), 'amount')
->sortable()
->min(1) // -> i need to change this based on "size" form model resource
->max(9999)
->step(1) // -> i need to change this based on "size" form model resource
->updateRules('nullable')
->rules('required', 'number')
->help(__('in kilograms')),
如何在laravel字段中加载这个JS数组“ConfirmActionModal['selectedResources'][0]”?
我不擅长JS,如何将值加载到php中?
【问题讨论】:
标签: javascript arrays laravel laravel-nova