dev-master
9999999-devSocial is a HybridAuth implementation for Laravel
MIT
The Requires
- php >=5.3.0
- laravel/framework ~4
- hybridauth/hybridauth *
by Jan Hartigan
laravel social oauth google login facebook twitter openid hybridauth yahoo
Wallogit.com
2017 © Pedro Peláez
Social is a HybridAuth implementation for Laravel
"frozennode/social": "*"
php composer.phar install
'Frozennode\Social\SocialServiceProvider', to your config/app.php filephp artisan config:publish frozennode/social
app/config/packages/frozennode/social/hybridauth.php
app/config/packages/frozennode/social/db.php file to see if you need to customise anything (see Configuration below for help)php artisan migrate --package='frozennode/social'
Profile model (using a different name if you changed the config)Set the User to have many Profiles:, (*1)
public function profiles() {
return $this->hasMany('Profile');
}
Set the Profile to belong to a User:, (*2)
public function user() {
return $this->belongsTo('User');
}
This package comes with several configuration files, and you must edit at least one of them., (*3)
Before you can run this package, you need to publish the config files to your own app - which you can easily do using artisan:, (*4)
artisan config:publish frozennode/social
You will then find the configuration files in your app/config/packages directory., (*5)
Be sure to put in all your service credentials (app id and app secret that you got from Facebook, LinkedIn, etc)., (*6)
This is almost the exact set of configuration used by the HybridAuth library itself, so see their documentation for more information., (*7)
This file specifies everything related to your database and models. This package expects you to have a users table, and it will create a profiles table for you with the migration., (*8)
Note that you should edit this file BEFORE YOU RUN THE MIGRATION, since the migration itself reads this config., (*9)
Hopefully most of the values in this file are self explanatory, the exceptions being the "profiletousermap", "userrules" and "uservalues" keys., (*10)
profilestousersmap
This is used when a new user is created from a social login. It is a reasonably common case that you will have some properties on User that are mapped to Profiles, but you may want to keep them directly in the User model to make your life easier when > dealing with users who were not registered using this method., (*11)
Specifying this will map fields from the Profile to the newly > created User., (*12)
Keys are attribute names from the Profile (which mirrors the original HybridAuth Adapter) and values are attribute names on the User model., (*13)
userrules
If you are using Ardent to automatically validate models (and stop them from being saved if validation fails) you may want to specify a set of override rules here when creating new Users., (*14)
uservalues
This is similar to the profiletousermap, but much more flexible. You can specify specific values for certain attributes on new Users (i.e. a "role_id" for all "customers"), or even provide a callback to run - the callback will be passed in the new (unsaved) user and the original HybridAuth Adapter profile of values., (*15)
See the routes.php config file to alter the default routes, (*16)
Social is a HybridAuth implementation for Laravel
MIT
laravel social oauth google login facebook twitter openid hybridauth yahoo