-
Notifications
You must be signed in to change notification settings - Fork 10
2.x Usage Lumen
Sam edited this page Apr 27, 2019
·
2 revisions
- Create the Controller.
- This example Controller will be placed in the
app/Http/Controllers/Auth/
folder.
- This example Controller will be placed in the
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use kanalumaddela\LaravelSteamLogin\Http\Controllers\AbstractSteamLoginController;
use kanalumaddela\LaravelSteamLogin\SteamUser;
class SteamLoginController extends AbstractSteamLoginController
{
/**
* Return the player's details in json for example purposes.
*
* @param \Illuminate\Http\Request $request
* @param \kanalumaddela\LaravelSteamLogin\SteamUser $steamUser
*
* @return \Illuminate\Http\JsonResponse
*/
public function authenticated(Request $request, SteamUser $steamUser)
{
$steamUser->getUserInfo();
return \response()->json($steamUser->toArray(), 200, [], JSON_PRETTY_PRINT);
}
}
- Add the routes to your
routes/web.php
$router->get('login/steam', ['uses' => 'Auth\SteamLoginController@login', 'as' => 'login.steam']);
$router->get('auth/steam', ['uses' => 'Auth\SteamLoginController@authenticate', 'as' => 'auth.steam']);