Пример #1
0
 /**
  * Handle redirection from GitHub OAuth
  *
  * @param SocialiteManager $socialiteManager
  * @param UserService      $userService
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handleGitHubRdirect(SocialiteManager $socialiteManager, UserService $userService)
 {
     $user = $socialiteManager->driver('github')->user();
     $id = $userService->registerUser($user);
     \Auth::driver('github')->loginUsingId($id);
     return redirect()->route('main');
 }
Пример #2
0
 /**
  * Update phone number
  *
  * @param UserService  $user
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function updatePhoneNumber(UserService $userService)
 {
     $userId = \Auth::driver('github')->user()->getAuthIdentifier();
     $phoneNumber = \Input::get('phone_number');
     $updateResult = $userService->updatePhoneNumber($userId, $phoneNumber);
     return response()->json(['status' => $updateResult ? 'success' : 'failed']);
 }
Пример #3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $users = $this->userService->getUsers();
     foreach ($users as $user) {
         echo 'GitHub name: ' . $user->github_name . " checking\n";
         if (!$this->gitHubService->checkContribution($user->github_name)) {
             $this->yoService->sendYo($user->yo_name);
             \Log::info('GitHub name: ' . $user->github_name . ' is lazy person');
         }
     }
 }
 /**
  * Execute the console command.
  *
  * @param TwilioInterface  $twilio
  * @param GitHubService    $gitHubService
  * @param UserService      $userService
  * @return mixed
  */
 public function handle(TwilioInterface $twilio, GitHubService $gitHubService, UserService $userService)
 {
     $users = $userService->getUsers();
     foreach ($users as $user) {
         if (!$gitHubService->checkContribution($user->name) && $user->phone_number !== 'tmp') {
             $twilio->call($user->phone_number, function ($message) {
                 $message->play('http://saborunayo.sota1235.net/sounds/shinchoku.mp3', ['loop' => 2]);
                 sleep(1);
             });
         }
     }
 }