1
Good evening friends, I am new to the Laravel and I need to build a function for data search of a table, I did something based on what I understood so far, but this returning me the following error message **Tokenmismatchexception in Verifycsrftoken.php line 67:**when the route is requested. below follows the code:
Routes.php
Route::post('clientes/pesquisa', 'ClientesController@pesquisa');
Clientescontroller.php
public function pesquisa(){
$pesq = Input::get('pesq');
$resultado = Tb_clientes::where('idempresa', 1)->where('nome', '=',$pesq)->get();
return view('clientes.index')->with('tb_clientes', $resultado);
}
The call place of the route
<form class="form-inline" method="post" role="form" action="/clientes/pesquisa">
<div class="form-group">
<label >Pesquisar:</label>
<input type="text" class="form-control input-sm" id="pesq">
</div>
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></button>
</form>
I’m doing it right or there’s an easier way?
Welcome to Sopt. Go to Help and take the Tour. Here in case of this issue you need to present part of your code. Edit the question and enter the code below it. It will be easier to help you.
– Leo
Edited. Thank you
– Filipe Guedes
Perfect! Nice work! Be sure to mark the answer that served you in some way (or the best among them) and vote on the questions and answers that are important leave you.
– Leo