Issue
I want to condition the login redirection of user if the data of local storage is true or false,. example: if data is true,.. it will redirect it 1st page, else it will redirect it in 2nd page? Is their a laravel command or php command to get the values/data from local storage?
sorry for my english, i hope some one can help,. thanks
Solution
Laravel is build on PHP is server side language and there is no option to check the localstorage that is client side on server to load view. You will need to check the localstorage data in the view file and then redirect to the page as you need. Something like
<script>
var user = localStorage.getItem('user');
if(user){
window.location.replace("http://stackoverflow.com/user_profile");
} else {
window.location.replace("http://stackoverflow.com/login");
}
</script>
Answered By - Saleem Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.