Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Support\Facades\Auth;
- use Invisnik\LaravelSteamAuth\SteamAuth;
- use App\Player;
- class AuthController extends Controller
- {
- /**
- * @var SteamAuth
- */
- private $steam;
- public function __construct(SteamAuth $steam)
- {
- $this->steam = $steam;
- }
- public function login()
- {
- if ($this->steam->validate()) {
- $info = $this->steam->getUserInfo();
- if (!is_null($info)) {
- $user = Player::where('playerid', $info->steamID64)->first();
- if (is_null($user)) {
- return response()->view('noacc');
- }
- Auth::login($user, true);
- return redirect('/home');
- }
- }
- return $this->steam->redirect();
- }
- public function logout(){
- Auth::logout();
- return redirect()->route('welcome');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement