Атм, я использую API Steamauth, чтобы захватить Steam пользователей и передать его в user-> steamid, но я хочу ограничить его, если поле с именем steamid в пользователях не нулевое (уже имеет steamid), они не могут введите маршрут и получите перенаправление назад. Я пытался в течение нескольких часов, но я не могу заставить его работать. Это мой AuthController банкомат:
use Invisnik\LaravelSteamAuth\SteamAuth;
use App\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
class AuthController extends Controller
{
/**
* The SteamAuth instance.
*
* @var SteamAuth
*/
protected $steam;
/**
* The redirect URL.
*
* @var string
*/
protected $redirectURL = '/';
/**
* AuthController constructor.
*
* @param SteamAuth $steam
*/
public function __construct(SteamAuth $steam)
{
$this->steam = $steam;
$this->middleware('auth');
}
/**
* Redirect the user to the authentication page
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function redirectToSteam()
{
return $this->steam->redirect();
}
/**
* Get user info and log in
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function handle()
{
if ($this->steam->validate()) {
$info = $this->steam->getSteamId();
if (!is_null($info)) {
Auth::user()->update(['steamid' => $info]);
return redirect($this->redirectURL); // redirect to site
}
}
return $this->redirectToSteam();
}