Laravel 5 getting ID from URL

前端 未结 7 1790
一整个雨季
一整个雨季 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条回答
  •  Happy的楠姐
    2020-12-31 08:58

    Route::get('post/user/{id}','ProductController@allpost')->where('id', '[0-9]+');
    

    Controller

    public function allpost($id)
        {
            $products = Product::where('uploadby', $id)->orderBy('created_at','desc')->paginate(5); 
    return view('product.user_product')->with('products', $products); }

提交回复
热议问题