Laravel IsAuth is a Laravel package by Emre Dipi that provides control to check if a user session is dead before submitting forms. If the session is dead, a modal will prompt the user to login.
This package depends on jQuery and Sweet Alert, and a little bit of custom JS which helps provide a modal experience for your login modal:
1<script> 2 let user={ 3 name:"{{$user->name}}", 4 email:"{{$user->email}}", 5 photo:"{{$user->getFirstMediaUrl("image","thumb")}}" //edit this up to your system or just remove this line. 6 }; 7</script> 8<style> 9 .swal-icon--custom>img{10 max-height: 250px;11 border-radius: 50%;12 }13</style>14<script src="/assets/SpiderWebtr/isAuth/isAuth.js"></script>
You can learn more about this package, get full installation instructions, and view the source code on GitHub at spiderwebtr/isauth. This package is very new, so if you try it out, provide the author with some feedback and submit anything you find issues within a pull request. A password prompt for an expired session is one of those nice touches that are helpful; building your own version might be an excellent exercise in making a package.
0 comments:
Post a Comment
Thanks