Migration complete

This commit is contained in:
2026-06-23 19:24:38 +02:00
parent 279160c1cb
commit 64b26ef059
126 changed files with 8121 additions and 221 deletions

View File

@@ -5,32 +5,60 @@ namespace App\Auth;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
/**
* Xenforo authentification bridge.
*/
class XenForoGuard implements Guard
{
/**
* Authenticated user.
* @var XenForoUser|null
*/
private ?XenForoUser $user = null;
public function __construct(private readonly Request $request) {}
/**
* Check if user is logged in.
* @return bool
*/
public function check(): bool
{
return $this->user() !== null;
}
/**
* Check if user is a guest.
* @return bool
*/
public function guest(): bool
{
return ! $this->check();
}
/**
* Get user ID.
* @return mixed
*/
public function id(): mixed
{
return $this->user()?->getAuthIdentifier();
}
/**
* If user is defined.
* @return bool
*/
public function hasUser(): bool
{
return $this->user !== null;
}
/**
* Login user.
* @return XenForoUser|null
*/
public function user(): ?XenForoUser
{
if ($this->hasUser())
@@ -64,6 +92,13 @@ class XenForoGuard implements Guard
return $this->user = new XenForoUser($xfUser);
}
/**
* Unused.
*
* @param array $credentials
*
* @return bool
*/
public function validate(array $credentials = []): bool
{
return false;
@@ -74,6 +109,10 @@ class XenForoGuard implements Guard
$this->user = $user;
}
/**
* Unused.
* @return void
*/
public function logout(): void
{
redirect('/');