1

当我单击提交按钮时,会出现此页面:缺少 [Route: viewticketuser] [URI: viewticketuser/{id}] 所需的参数,乍一看,当我只想显示所有票时,更新按钮正常工作,然后当我制作对于每个用户,它都会发生错误

看法:


        @foreach($ticket as $user)
            <tbody>
            <tr>
                <td>{{$user->ticket_id}}</td>
                <td>{{$user->description}}</td>

                <td>{{$user->status}}</td>
                <td>{{$user->assigned_user_id_fk}}</td>
                <td>{{$user->created_at}}</td>
                <td>
                    <form action="{{ route('updateticketadmin',$user->ticket_id) }}" method="post">

                                @csrf


                                <select class="form-control" name="status">

                            <option value=0>0</option>
                            <option value=1>1</option>
                        </select>


                        <button style="width: 100%" type="submit" class="block btn btn-success">Change Status</button>
                    </form>

                </td>
            </tr>
            </tbody>
        @endforeach

网页.php:

    Route::post('updateticketadmin/{id}','TicketController@updatestatusadmin')->name('updateticketadmin')->middleware('is_admin');

控制器:

public function updatestatusadmin(Request $request, $id)
    {

        $request->validate([
            $status='status' => 'required',
        ]);
        $status=(int)$status;



        return redirect()->route('ticketshow')->with('Success', 'Status Changed Succesfully!');

    }


4

0 回答 0