本文整理匯總了PHP中Facebook::process方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facebook::process方法的具體用法?PHP Facebook::process怎麽用?PHP Facebook::process使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Facebook
的用法示例。
在下文中一共展示了Facebook::process方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getFacebook
public function getFacebook()
{
$session = Facebook::process()->getLongLivedSession();
Session::put('fbSession', $session);
// Access Token
$accessToken = $session->getToken();
// User info
$userfb = Facebook::api($session, 'GET', '/me');
//die($userfb->getProperty('id'));
$user = self::__checkExistenceFb($userfb->getProperty('id'));
if ($user) {
if ($user->is_approved) {
Auth::login($user);
return Redirect::to('/');
} else {
Session::flash('message', 'Su usuario aún no ha sido aprovado.');
return Redirect::to('login');
}
} else {
$user = new User();
$user->facebook_id = $userfb->getProperty('id');
$user->name = $userfb->getProperty('name');
$user->last_name = $userfb->getProperty('last_name');
$user->display_name = $userfb->getProperty('name');
$user->profile_type = "general";
$user->email = $userfb->getProperty('email');
$user->mobile = "0999999999";
$sendMail = false;
if (!$user->id) {
//new user
$passwordText = str_random(8);
$passwordHashed = Hash::make($passwordText);
$sendMail = true;
$user->password = $passwordHashed;
$user->is_approved = false;
}
$user->save();
Auth::logout();
Session::flash('message', 'Su usuario debe ser aprobado por el administrador.');
return Redirect::to('login');
}
}