-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #240 from P3D-Legacy/develop
- Loading branch information
Showing
4 changed files
with
108 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace App\Listeners\Auth; | ||
|
||
use Artisan; | ||
use Illuminate\Auth\Events\Login; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class UpdateUserGameJoltData | ||
{ | ||
/** | ||
* Handle the event. | ||
* | ||
* @param Login $event | ||
* @return void | ||
*/ | ||
public function handle(Login $event) | ||
{ | ||
$user = null; | ||
|
||
/** | ||
* If the event is Login, we get the user from the web guard. | ||
*/ | ||
if ($event instanceof Login) { | ||
$user = Auth::user(); | ||
} | ||
|
||
/** | ||
* If no user is found, we just return. Nothing to do here. | ||
*/ | ||
if (is_null($user)) { | ||
return; | ||
} | ||
|
||
// Check if user has gamejolt account | ||
if (! $user->gamejolt) { | ||
return; | ||
} | ||
|
||
// Run commands to update user data | ||
Artisan::call('gj:update-trophies', [ | ||
'gamejolt_user_id' => $user->gamejolt->id, | ||
]); | ||
Artisan::call('sync:gamesave', [ | ||
'gamejolt_user_id' => $user->gamejolt->id, | ||
]); | ||
Artisan::call('sync:game-save-gamejolt-account-trophies', [ | ||
'gamejolt_user_id' => $user->gamejolt->id, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters