I'm starting with laravel about 2 weeks ago and it's automatically raining with doubts.
I have a Registration form with the following button below:
<button type="button" class="btn btn-primary" id="cadastrar-usuario">
<i class="fa fa-check"></i> Cadastrar Usuário
</button>
I have a UserController.php that lists the Users, remembering that I am not using the same users table of laravel, I will use it later.
I would like to call a function from my controller.
My Controller looks like this:
<?php namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
class UsuarioController extends Controller {
public function lista(){
$usuarios = DB::select("select * from usuarios");
return view('usuarios.listagem')->with('usuarios', $usuarios);
}
}
?>
How could I call it using ajax?