Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: squash migrations #826

Merged
merged 3 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/Console/Commands/GenerateScoutIndexesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Models\Account;
use App\Models\GamePlayerBan;
use App\Models\MinecraftPlayerAlias;
use Illuminate\Console\Command;

class GenerateScoutIndexesCommand extends Command
Expand All @@ -14,7 +13,6 @@ class GenerateScoutIndexesCommand extends Command
private $models = [
Account::class,
GamePlayerBan::class,
MinecraftPlayerAlias::class,
];

public function handle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Controllers\Api\v1;

use App\Models\MinecraftPlayerAlias;
use App\Models\MinecraftPlayer;
use Illuminate\Http\Request;

class MinecraftPlayerAliasSearchController
Expand All @@ -11,7 +11,7 @@ public function __invoke(Request $request)
{
$query = $request->input('query');

return MinecraftPlayerAlias::search($query)
return MinecraftPlayer::where('alias', 'like', '%'.$query.'%')
->take(25)
->get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function index(
Request $request,
) {
$minecraftUsername = $request->user()
?->minecraftAccount?->first()
?->aliases?->first()
?->minecraftAccount
?->first()
?->alias;

$applicationInProgress = BuilderRankApplication::where('status', ApplicationStatus::IN_PROGRESS->value)
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Panel/MinecraftPlayerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MinecraftPlayerController extends WebController
*/
public function index()
{
$minecraftPlayers = MinecraftPlayer::with(['account', 'aliases'])->paginate(50);
$minecraftPlayers = MinecraftPlayer::with(['account'])->paginate(50);

return view('admin.minecraft-player.index')->with(compact('minecraftPlayers'));
}
Expand Down Expand Up @@ -64,7 +64,7 @@ public function store(Request $request, MojangPlayerApi $api)
*/
public function show(MinecraftPlayer $minecraftPlayer)
{
$minecraftPlayer->load(['account', 'aliases', 'gamePlayerBans', 'gamePlayerBans.bannedPlayer.aliases', 'gamePlayerBans.bannerPlayer.aliases']);
$minecraftPlayer->load(['account', 'gamePlayerBans', 'gamePlayerBans.bannedPlayer', 'gamePlayerBans.bannerPlayer']);

return view('admin.minecraft-player.show')->with(compact('minecraftPlayer'));
}
Expand Down
10 changes: 1 addition & 9 deletions app/Http/Controllers/Panel/MinecraftPlayerLookupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use App\Core\Domains\Mojang\Api\MojangPlayerApi;
use App\Http\Controllers\WebController;
use App\Models\MinecraftPlayer;
use App\Models\MinecraftPlayerAlias;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;

Expand Down Expand Up @@ -38,14 +37,7 @@ private function lookupByStoredAlias($alias): ?MinecraftPlayer
if (strlen($alias) < 3 || strlen($alias) > 16) {
return null;
}

$mcPlayerAlias = MinecraftPlayerAlias::where('alias', $alias)->first();

if ($mcPlayerAlias == null) {
return null;
}

return $mcPlayerAlias->minecraftPlayer;
return MinecraftPlayer::where('alias', 'like', '%'.$alias.'%')->first();
}

/**
Expand Down
9 changes: 0 additions & 9 deletions app/Models/MinecraftPlayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ public function account(): BelongsTo
);
}

public function aliases(): HasMany
{
return $this->hasMany(
related: MinecraftPlayerAlias::class,
foreignKey: 'player_minecraft_id',
localKey: 'player_minecraft_id',
);
}

public function gamePlayerBans(): HasMany
{
return $this->hasMany(
Expand Down
47 changes: 0 additions & 47 deletions app/Models/MinecraftPlayerAlias.php

This file was deleted.

28 changes: 0 additions & 28 deletions database/factories/MinecraftPlayerAliasFactory.php

This file was deleted.

70 changes: 0 additions & 70 deletions database/migrations/2017_09_15_131358_create_users.php

This file was deleted.

104 changes: 0 additions & 104 deletions database/migrations/2017_09_15_154714_create_servers.php

This file was deleted.

Loading
Loading