1

这是我的代码的一部分:

$form = new Form(new Shop());
$form->tab('terminal', function (Form $form) use ($id) {
        $form->hasMany('shopterminal', '', function (Form\NestedForm $form) {
            $form->text('terminal_num', 'terminal number')->required();
            $form->select('poz_type', 'POS type')->options(['static' => 'one', 'dynamic' => 'two'])->required();
            $form->select('psp_id', 'POZ name')->options(Psp::pluck('name', 'id'))->required();
            $form->text('sheba', 'sheba number');
            $form->text('account_num', 'account number')->required();
            $form->select('bank_id', 'bank name')->options(Bank::pluck('name', 'id'))->required();

    dd($form);

});

这是结果dd($form)

在此处输入图像描述

我需要获取terminal_imageitem 的值(即15841949062134.png)。知道我怎么能得到它吗?

请注意,以下语法均无效:

  • $form->get('terminal_image')
  • $form->select('terminal_image')
  • $form->terminal_image
  • $form()->terminal_image
  • $form->relation->terminal_image
4

2 回答 2

0

您可以使用 :

$form->form->model->relations['shopterminal']->items[0]->attributes['terminal_image']
于 2020-03-17T09:07:20.937 回答
0

对于您的具体示例:

$form->form->model->shopterminal[0]->terminal_image
于 2020-03-17T08:40:56.683 回答