basically i want to save the data from a modal form to databases.
the modal that i use is modal from a bootstrap i place it at main.blade.php and i create a AuthControler with artisan without -r. and add a new routes into web.php if you ask why i didnt use php artisan make:auth. well it's because its more complicated to edit the whole code to my own html code that i already made it from the first time IMO. hope you all can help me.
here is the main layout
main.blade.php
<div id="modal-register" class="modal fade">
<div class="modal-dialog modal-register">
<div class="modal-content">
<form method="post" action="">
<div class="modal-header">
@csrf
<h4 class="modal-title">Register</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>Nama Lengkap</label>
<input type="text" name="name" id="input-name"class="form-control" required="required">
</div>
<div class="form-group">
<label>Email</label>
<input type="email" name="email" id="input-email" class="form-control" required="required" placeholder="ex:abcdefg@gmail.com">
</div>
<div class="form-group">
<div class="clearfix">
<label>Password</label>
<input type="password" name="password" id="input-password" class="form-control" required="required">
</div>
</div>
<div class="form-group">
<div class="clearfix">
<label>Konfirmasi Password</label>
<input type="password" name="password-confirmation" id="input-password" class="form-control" required="required" placeholder="Masukkan kembali password anda">
</div>
</div>
</div>
<div class="modal-footer">
<input type="submit" class="btn btn-primary pull-right service-btn" value="Register">
</div>
</form>
</div>
</div>
</div>
AuthController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AuthController extends Controller
{
//
public function getLogin(){
return view('login');
}
public function postLogin(Request $request){
//
}
public function getRegister(){
return view('Register');
}
public function postRegister(Request $request){
dd('ok');
}
}
web.php
<?php
//register
route::get('/register','AuthController@getRegister');
route::post('/register','AuthController@postRegister');
//login
route::get('/login','AuthController@getLogin');
route::post('/login','AuthController@postLogin');
Aucun commentaire:
Enregistrer un commentaire