Good night friends, I am new to laravel and I need to build a function to search for data from a table, I did something based on what I understood so far, but it is returning me the following error message ** TokenMismatchException in VerifyCsrfToken. php line 67: ** when the route is requested. Here is the code below:
routes.php
Route::post('clientes/pesquisa', 'ClientesController@pesquisa');
CustomersController.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 route call location
<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>
Am I doing it right or does it have an easier way?