需要您的帮助。
如何使用larvel在表单上传递多个变量数据...
我有一些样品,但是有一个错误

ErrorException in UrlGenerationException.php line 17:
Missing required parameters for [Route: editeammember.post] [URI: editeammember/{idteam}/{idmember}]. (View: E:\wamp64\www\gplspring2017\resources\views\admin\editteammember.blade.php)


这是我的表单代码:

<form class="form-horizontal" role="form" method="POST" action="{{ route('editeammember.post', $member->gpl_team_id.'/'.$member->team_member_id) }}"></form>


这是我的控制器

public function editteammember(Request $request, $idteam, $idmember)
    {
        $teams = DB::table('gpl_team')->where('gpl_team_id', $idteam)->get();

        $count = count($teams);

        if(!$count)
        {
            return redirect('404');
        }
        else
        {
            $member_image = $request->input('member_image');
            $member_summoner = $request->input('member_summoner');
            $member_name = $request->input('member_name');
            $member_role = $request->input('member_role');
            $updated_at = date("Y-m-d H:i:s");

            $this->validate(request(), [
                'member_image' => 'required|max:255',
                'member_summoner' => 'required|max:255',
                'member_name' => 'required|max:255',
                'member_role' => 'in:Top Lane, Jungle, Mid Lane, AD Carry, Support, Substitute',
                ]
            );

            DB::table('team_member')->where('team_member_id', $idmember)->where('gpl_team_id', $idteam)->update([
                ['member_pic' => $member_image, 'member_summoner' => $member_summoner, 'member_name' => $member_name, 'member_role' => $member_role, 'updated_at' => $updated_at, ]
            ]);

            return redirect()->back()->with('message', 'Member is successfully Updated!');
        }
    }


希望你能帮我...谢谢

最佳答案

将参数作为数组传递:

{{ route('editeammember.post', [$member->gpl_team_id, $member->team_member_id]) }}


有关更多参考:route()

关于php - Laravel 5.4上的多个变量数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43181782/

10-10 22:30