Exemplo n.º 1
0
 public function findByUsernameOrCreate($userData, $code)
 {
     $user = User::firstOrCreate(['name' => $userData->getName(), 'email' => $userData->getEmail(), 'avatar' => $userData->getAvatar()]);
     $user->token = $userData->token;
     $user->code = $code;
     $user->save();
     return $user;
 }
Exemplo n.º 2
0
 public function getCalendars()
 {
     $user = User::find($user_id);
     $client = new \Google_Client();
     $client->setApplicationName(env('GOOGLE_APP_NAME'));
     $client->setDeveloperKey(env('GOOGLE_API'));
     $service = new Google_Service_Calendar($client);
     $calendarList = $service->calendarList->listCalendarList();
     while (true) {
         foreach ($calendarList->getItems() as $calendarListEntry) {
             echo $calendarListEntry->getSummary();
         }
         $pageToken = $calendarList->getNextPageToken();
         if ($pageToken) {
             $optParams = array('pageToken' => $pageToken);
             $calendarList = $service->calendarList->listCalendarList($optParams);
         } else {
             break;
         }
     }
 }
Exemplo n.º 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'])]);
 }