How to create a popup login in Laravel?


1. Make sure you already have a login page and user table in database. If not, create them using:
 php artisan make:auth 

Then, refresh your database to migrate newly created user table by using :
 php artisan migrate:refresh 

2. Open your login.blade.php in your editor. 

3. Add this code before your <form> tag 
<div class="modal fade" id="masuk" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"> LOG IN</h4>
 </div>
<div class="modal-body">

Rename id attribute into your own. 

4. Add this code after your </form> tag 
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary m-t-10" data-dismiss="modal"> Close </button>
</div>
</div>
</div>
</div> 

5. Next, add this code after the <div class="panel-body"> tag 
<button class="btn btn-primary" data-toggle="modal" data-target="#masuk"> Login </button> 

Make sure data-target attribute set to the same name as your id before 

6. Refresh your browser and try login.

0 pendapat bernas .