Laravel 5 getting ID from URL

前端 未结 7 1788
一整个雨季
一整个雨季 2020-12-31 08:22

I have a table view in which I can click an button icon and redirect to another page carrying the id of the row that has been clicked.

@foreach ($pa         


        
7条回答
  •  無奈伤痛
    2020-12-31 08:48

    This is late. But for the benefit of others like me;

    If you do not have to do it in a method like the answers above have shown, As of Laravel 5.0 (Not sure about previous versions), you can do

    $request->route('id');
    

    That returns the value of the id parameter on the route.

提交回复
热议问题