php - Using Laravel 4 Facebook Login compare profile link when login
I'm wondering if anyone can help me, I am building aLaravel-4
application that uses theFacebook API
. Currently I've managed to gain a connection to facebook and can login to the application.
However I want to control where the users go based on if there facebook profile link exists in thedatabase
. Currently I've got a form that takes theurl
of their profile and inserts it into the DB.
This is my facebook profile link:
https://www.facebook.com/profile.php?id=100006760337073
However when I make a request to facebook I get this response:
array(11) {
["id"]=> string(16) "1536122286623101"
["email"]=> string(16) "[email protected]"
["first_name"]=> string(4) "Jack"
["gender"]=> string(4) "male"
["last_name"]=> string(8) "Coldrick"
["link"]=> string(61) "https://www.facebook.com/app_scoped_user_id/1536122286623101/" ["locale"]=> string(5) "en_US"
["name"]=> string(13) "Jack Coldrick"
["timezone"]=> int(1)
["updated_time"]=> string(24) "2014-09-05T16:35:17+0000"
["verified"]=> bool(true)
}
The['link']
does not match theprofile link
in the url bar so my logic won't work because I am comparing these two. I'm wondering what the best way would be to store the users profile in thedb
and when they login check to see if they exist in thedb
.
Any help is much appreciated.
This is mycontroller
public function handleAddFacebook(){
//Make an entry into the winners table of the DB
$facebookWinner = new FacebookWinner();
$facebookWinner->profile_link = Input::get('link');
$facebookWinner->origin = Input::get('origin');
$facebookWinner->destination = Input::get('destination');
$facebookWinner->win_date = date('Y-m-d');
$facebookWinner->save();
return View::make('admin.dashboard');
}
Is there any way I could use theInput::get('link')
to request the users id from facebook?