当我运行$value = $request->session()->all();
时,控制器一将值“ product”设置为null。第二个给出正确的产品ID。它们在同一页上。两者都是引导程序模态中的形式。他们为什么要提供不同的会话数据?陷入困境。
表单是从产品页面提交的->我想要的ID是不是从表单提交的-> ID是从产品页面提交的
控制器一号
{!! Form::open(['action' => 'ControllerOne@store', 'method' => 'POST', 'enctype' => 'multipart/form-data']) !!}
{{Form::label('time', 'Select a Time')}}
{{Form::time('time', '', ['class' => 'form-control', 'placeholder' => 'Time'])}}
{{Form::label('date', 'Select a Date')}}
{{Form::text('date', '', ['class' => 'form-control', 'placeholder' => 'Date'])}}
<div class="modal-footer">
{{Form::submit('Add', ['class'=>'btn btn-primary'])}}
{!! Form::close() !!}
控制器二
{!! Form::open(['action' => 'ControllerTwo@store', 'method' => 'POST', 'enctype' => 'multipart/form-data']) !!}
{{Form::label('listing', 'Price (NZD)')}}
{{Form::text('price', '', ['class' => 'form-control', 'placeholder' => 'Price'])}}
{{Form::label('listing', 'Name')}}
{{Form::text('name', '', ['class' => 'form-control', 'placeholder' => 'Name'])}}
{{Form::label('listing', 'Phone Number')}}
{{Form::number('phone_number', '', ['class' => 'form-control', 'placeholder' => 'Phone Number'])}}
{{Form::label('listing', 'Comments/Conditions')}}
{{Form::textarea('conditions', '', ['class' => 'form-control', 'placeholder' => 'Comments/Conditions'])}}
{{Form::submit('Submit', ['class'=>'btn btn-success'])}}
{!! Form::close() !!}