0
I’m learning Laravel 6 and I made a registration form (I’m not using Laravel’s auth) and when I send the data and perform the Insert in the table it returns TRUE, but when I check in the Database it did not enter anything.
I created my controller with the following command
php artisan make:controller UserController --resource
My . env is like this
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=presenceControll
DB_USERNAME=root
DB_PASSWORD=1234
My shipping form
<form action="/user/cadastrar" method="POST">
@csrf
<div class="form-row">
<fieldset class="form-group col-md-6 col-sm-12"><br>
<label for="email">E-mail</label>
<input required type="email" class="form-control" id="email" placeholder="[email protected]">
</fieldset>
<fieldset class="form-group col-md-6 col-sm-12"><br>
<label for="text">CPF</label>
<input required type="text" class="form-control" id="cpf" placeholder="000.000.000-00">
</fieldset>
</div>
<div class="form-row">
<fieldset class="form-group col-md-4 col-sm-12">
<label for="nome">Nome</label>
<input required type="text" class="form-control" id="nome" placeholder="Digite seu nome">
</fieldset>
<fieldset class="form-group col-md-8 col-sm-12">
<label for="sobrenome">Sobrenome</label>
<input required type="text" class="form-control" id="sobrenome" placeholder="Digite seu sobrenome">
</fieldset>
</div>
<div class="form-row">
<fieldset class="form-group col-md-6 col-sm-12">
<label for="password">Senha</label>
<input required type="password" class="form-control" id="password" placeholder="Digite sua senha">
</fieldset>
<fieldset class="form-group col-md-6 col-sm-12">
<label for="password">Confirmar senha</label>
<input required type="password" class="form-control" id="password_confirm" placeholder="Repita sua senha">
</fieldset>
</div>
<button required type="submit" class="btn btn-dark btn-block">Cadastrar</button><br>
</form>
My view routes and form submission
Route::get('/user/cadastro', 'UserController@create');
Route::post('/user/cadastrar', 'UserController@store');
and finally my controller returns TRUE in dd
public function create(){
return View('/user/cadastro');
}
public function store(Request $request){
$retorno = \DB::table('user')->insert($request->except('_token'));
dd($retorno);
}
I followed the documentation from Laravel, I wonder what I’m doing wrong
I hadn’t noticed that it was the name I was recovering, thank you!
– Andre Lacomski