How to pass form parameter for an Laravel route in an API?

Asked

Viewed 365 times

0

Errorexception in Urlgenerationexception.php line 17: Missing required Parameters for [Route: v1.clientes.search] [URI: v1/clients/search/{name}/{situation}]. (View: C: xampp htdocs api-updater Resources views client search.blade.php)


form role="form" 
     class="horizontal"
     action="{{action('ClientesController@searchBy',$nome ="nome",$situacao ="situacao")}}" 
     method="get"
>

Route::get('/search/{nome}/{situacao}', 
           ['as'=>'v1.clientes.search',
            'uses'=>'ClientesController@searchBy']
);

1 answer

1

According to her own documentation of the Laravel To generate a url by running parameters using the helper action(), you must pass on the second helper argument a array with the parameters you want to send, thus

<form role="form" class="horizontal" method="get" action="{{ action('ClientesController@searchBy',["nome" => $nome, "situacao" => $situacao]) }}" >

Browser other questions tagged

You are not signed in. Login or sign up in order to post.