php - Eloquent functionaliy lost in Else{} -


i have route following:

simply put have following:

route::get('login/linkedin', function() {                 $userid = auth::id();                dd($userid);   <----this works         $provider = new linkedin(config::get('social.linkedin'));      if ( !input::has('code')) {         // if don't have authorization code, 1         $provider->authorize();       }else{  } 

but when :

route::get('login/linkedin', function() {        $provider = new linkedin(config::get('social.linkedin'));      if ( !input::has('code')) {         // if don't have authorization code, 1         $provider->authorize();       }else{                $userid = auth::id();                dd($userid);   <----this returns null    } 

why cant use auth:: after else?

why not try this:

route::get('login/linkedin', function() {      $userid_aux = auth::id();      $provider = new linkedin(config::get('social.linkedin'));      if ( !input::has('code')) {         // if don't have authorization code, 1         $provider->authorize();       }else{                $userid = $userid_aux;                dd($userid);   <----this returns null    } 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -