Welcome Guest, Not a member yet? Register   Sign In
fail to set flashdata after destroy session on logout

(This post was last modified: 05-26-2020, 07:33 AM by nmaa3003.)


this is my code:
PHP Code:
    public function logout()
        $adminModel = new AdminModel();
        $category 'last_logout';
        $merchant $this->session->get('merchant');
        $action $merchant->email ' has logged out!';

        $this->session->setFlashdata('success''You have successfully logged out!');
        return redirect()->to('/merchant/login');

so, notice that i setFlashdata after session destroy.
it's not triggering the flashdata when redirected to login page.

was that intentional or was that a bug?

just found solution, just use $this->session->remove('merchant');

I have the same problem Sad

I think you could also do:
return redirect()->to('/merchant/login')->withCookies();

(11-09-2021, 10:05 AM)Halim Wrote: I have the same problem Sad

The session is destroyed. There is no place to put the flash data. The session is not created again until the controller class that creates the next page is executed which is after the set flash data statement.
Simpler is always better

Theme © iAndrew 2016 - Forum software by © MyBB