mardi 4 octobre 2016

Why laravel view data persists during testing?

I have encountered an awkward bug. I have the following code:

    // if user clicked 'register with Facebook' button
    if(session()->has('providerUser')){
        $name = explode(' ', session('providerUser')->getName());

        view()->share([
            'first_name'    => $name[0],
            'last_name'     => $name[1] ?: '',
            'email'         => session('providerUser')->getEmail()
        ]);
    }

I have another method that clears the session, so when I get redirected back the view does not have variables $first_name, $last_name, $email.

But when I do the same checks in the session - they are present. What is strange - that is empty in the view and I have also debugged the controller it does not get inside the if(){} statement. And I am sure I am not declaring those variables anywhere else.

Aucun commentaire:

Enregistrer un commentaire