jeudi 30 juin 2016

How I can set session variable on click button event before auth laravel

Please help me out. I want to create a session variable when user will click on button then after login that variable i can call on home controller. When I am doing the below coding session is remembering either user is clicking on button or not every time after login it is displaying 1hi.

The function is:

$('#sub').on('click',function(){
        <?php \Session::put('testings', true);  
        ?>
    });

and the controller after login where I want to display is below:

public function home($reset = null){


        // indexed previous documents.
        $this->createResourcIndex();
        $this->title = 'Home';
        $folders = $folderList = [];
        $userLoggedIn = false;
        $sharedFiles = [];
        if(\Auth::check()){
            if(\Session::get('testings'))
            {
                echo \Session::get('testings');
                \Session::forget('testings');
                echo "hi";
            }
            else{
                echo "hello";
            }
            die;
}
}

Please help me out where I am wrong.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire