админка

This commit is contained in:
2026-03-13 23:33:35 +04:00
parent bae063a4fa
commit eaedeeb52b
41 changed files with 2506 additions and 67 deletions
+83
View File
@@ -0,0 +1,83 @@
<?php
namespace App\Models;
use App\Support\WowData;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Support\Carbon;
class GameAccountUser implements AuthenticatableContract
{
public function __construct(
public readonly int $id,
public readonly string $username,
public readonly string $email,
public readonly string $regMail,
public readonly int $gmLevel,
public readonly bool $locked,
public readonly ?string $lastLoginAt,
public readonly ?string $joinedAt,
public readonly string $saltHex,
public readonly string $verifierHex,
) {
}
public function getAuthIdentifierName(): string
{
return 'id';
}
public function getAuthIdentifier(): int
{
return $this->id;
}
public function getAuthPasswordName(): string
{
return 'verifier';
}
public function getAuthPassword(): string
{
return $this->verifierHex;
}
public function getRememberToken(): string
{
return '';
}
public function setRememberToken($value): void
{
}
public function getRememberTokenName(): string
{
return 'remember_token';
}
public function accessLabel(): string
{
return WowData::securityLevelName($this->gmLevel);
}
public function canAccessAdminPanel(): bool
{
return $this->gmLevel >= config('moonwell.portal.admin_min_gm_level');
}
public function joinedAtLabel(): string
{
return $this->formatDate($this->joinedAt);
}
public function lastLoginLabel(): string
{
return $this->formatDate($this->lastLoginAt);
}
private function formatDate(?string $value): string
{
return $value ? Carbon::parse($value)->format('d.m.Y H:i') : '—';
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class InviteCode extends Model
{
protected $fillable = [
'code',
'created_by_account_id',
'created_by_username',
'redeemed_by_account_id',
'redeemed_by_username',
'redeemed_at',
];
protected function casts(): array
{
return [
'redeemed_at' => 'datetime',
];
}
}