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
Post a Comment