public function handleProviderTwitterCallback()
 {
     if (!Auth::check()) {
         $user_social = Socialize::with('twitter')->user();
         $user = User::where('email', $user_social->nickname . '@twitter')->first();
         if (!isset($user)) {
             $user = new User();
             $user->email = $user_social->nickname . '@twitter';
             $user->name = $user_social->getName();
             $user->password = bcrypt(str_random());
             $user->save();
             $user_profile = new UserProfile();
             $user_profile->first_name = '';
             $user_profile->last_name = '';
             $user_profile->gender = '';
             $user_profile->avatar = $user_social->avatar;
             $user_profile->link = $user_social->user['url'];
             $user->userProfile()->save($user_profile);
         }
         Auth::login($user);
         return redirect('/channels');
     }
     return redirect('/');
 }
 public function show($id)
 {
     $user = User::findOrFail($id);
     return Response::json($user);
 }
Example #3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }