【发布时间】:2018-10-10 11:13:38
【问题描述】:
我想在显示的同一页面上更改用户数据。 基本上,我想选择已验证或拒绝,单击提交按钮,页面会随着更改而刷新。 所以我有这个代码:
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Receipt</th>
<th scope="col">Status</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<form method='POST' action="{{ action('PaymentController@update' , $user->id )}}"
enctype="multipart/form-data">
@csrf
@method('PUT')
<th scope="row">{{$user->id}}</th>
<td>{{$user->name}}</td>
<td>
<a href="/{{$user->receipt}}">{{$user->receipt}}</a>
</td>
@if( $user->payment_status != NULL )
<td>
PAYMENT VERIFIED
</td>
@else
<td>
<div class="form-group">
<select multiple class="form-control-sm" id="exampleFormControlSelect2" name="nsap_reg"
required="">
<option value="verified">Verified</option>
<option value="NULL">Rejected</option>
</select>
</div>
</td>
@endif
<td>
<input type="submit" value="SUBMIT">
</td>
</form>
</tr>
@endforeach
</tbody>
</table>
控制器:
public function update(Request $request, $id)
{
$request->validate([
'nsap_reg' => 'required',
]);
$payment_status = \App\User::find($id);
['nsap_reg' => $request->nsap_reg];
$payment_status->save();
return redirect('user-status');
}
我的问题是单击提交时没有任何反应,页面只是刷新。 任何帮助将不胜感激。
【问题讨论】: