Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Add all new users to the contacts list
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurGuy committed Jan 18, 2016
1 parent 70b3eee commit 4851d3c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/Http/Controllers/Auth/GitHubController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Controllers\Auth;

use App\Contact;
use Auth;
use App\User;
use GrahamCampbell\GitHub\GitHubManager;
Expand Down Expand Up @@ -60,6 +61,13 @@ public function handleProviderCallback()
$user = User::where('email', $socialiteUser->getEmail())->first();
if (!$user) {
$user = User::create(['email' => $socialiteUser->getEmail(), 'name' => $socialiteUser->getName()]);
//Add a contact record for the user so they receive update notifications
$contact = new Contact;
$contact->name = $user->name;
$contact->email = $user->email;
$contact->filter_tags = [];
$contact->active = true;
$contact->save();
}
Auth::login($user);
return redirect('/pings');
Expand Down

0 comments on commit 4851d3c

Please sign in to comment.