dimanche 22 mai 2016

laravel pass parameter by href as variable instead of Request object

I have a link pass an id to laravel controller, here is the link and routes and controller. at first scenario with $id paramter in contrller function it throws "Missing argument 1 for App\Http\Controllers\ProductController::edit()" error. when I change it to request it works what I expected, but I dont understand why laravel cant map id in query string to varaible $id in controller function??

 public function edit($id)//this throws missing argument exception, if I change $id to Request $request it works..
    {
        return view('frontend.product.create');
    }

<a data href=""><i class="fa fa-edit"></i> </a>

Route::get('product/edit', ['uses' => 'ProductController@edit', 'as'=>'product.edit']);



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1Wb4HWP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire