You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Add fixed cms 🆙
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Game\Player\UserCurrency;
|
||||
use App\Models\Game\Player\UserSetting;
|
||||
use App\Models\User;
|
||||
use App\Services\Community\StaffService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class LeaderboardController extends Controller
|
||||
{
|
||||
protected array $staffIds = [];
|
||||
|
||||
public function __construct(private readonly StaffService $staffService)
|
||||
{
|
||||
$this->staffIds = $this->staffService->fetchEmployeeIds();
|
||||
}
|
||||
|
||||
public function __invoke(): View
|
||||
{
|
||||
$topCredits = User::query()
|
||||
->whereNotIn('id', $this->staffIds)
|
||||
->orderByDesc('credits')
|
||||
->take(9)
|
||||
->get();
|
||||
|
||||
$getUserCurrency = fn ($type) => UserCurrency::query()
|
||||
->whereNotIn('user_id', $this->staffIds)
|
||||
->where('type', $type)
|
||||
->orderByDesc('amount')
|
||||
->take(9)
|
||||
->with(['user' => fn ($q) => $q->select('id', 'username', 'look')])
|
||||
->get();
|
||||
|
||||
return view('leaderboard', [
|
||||
'credits' => $topCredits,
|
||||
'duckets' => $getUserCurrency(0),
|
||||
'diamonds' => $getUserCurrency(5),
|
||||
'mostOnline' => $this->retrieveSettings('online_time'),
|
||||
'respectsReceived' => $this->retrieveSettings('respects_received'),
|
||||
'achievementScores' => $this->retrieveSettings('achievement_score'),
|
||||
]);
|
||||
}
|
||||
|
||||
private function retrieveSettings($column)
|
||||
{
|
||||
return UserSetting::select('user_id', $column)
|
||||
->whereNotIn('user_id', $this->staffIds)
|
||||
->orderByDesc($column)
|
||||
->take(9)
|
||||
->with('user:id,username,look')
|
||||
->get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Community\CameraService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class PhotosController extends Controller
|
||||
{
|
||||
public function __construct(private readonly CameraService $cameraService) {}
|
||||
|
||||
public function __invoke(): View
|
||||
{
|
||||
return view('community.photos', [
|
||||
'photos' => $this->cameraService->fetchPhotos(true),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Game\Room;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class RoomController extends Controller
|
||||
{
|
||||
public function __invoke(Room $room): View
|
||||
{
|
||||
return view('room.index', [
|
||||
'room' => $room->load('owner:id,username,look'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Community\Staff\WebsiteOpenPosition;
|
||||
use App\Models\Community\Staff\WebsiteStaffApplications;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class StaffApplicationsController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$positions = WebsiteOpenPosition::query()
|
||||
->where('position_kind', 'rank')
|
||||
->whereNotNull('permission_id')
|
||||
->with('permission')
|
||||
->whereHas('permission')
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
return view('community.staff-applications', compact('positions'));
|
||||
}
|
||||
|
||||
public function show(WebsiteOpenPosition $position): View
|
||||
{
|
||||
abort_unless($position->position_kind === 'rank', 404);
|
||||
$position->loadMissing('permission');
|
||||
abort_unless($position->permission, 404);
|
||||
|
||||
return view('community.staff-apply', compact('position'));
|
||||
}
|
||||
|
||||
public function store(Request $request, WebsiteOpenPosition $position)
|
||||
{
|
||||
abort_unless($position->position_kind === 'rank', 404);
|
||||
|
||||
$validated = $request->validate([
|
||||
'content' => ['required', 'string', 'min:10'],
|
||||
]);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
if ($user->hasAppliedForPosition($position->permission_id)) {
|
||||
return back()->withErrors([
|
||||
'content' => __('You have already applied for this position.'),
|
||||
])->withInput();
|
||||
}
|
||||
|
||||
WebsiteStaffApplications::create([
|
||||
'user_id' => $user->id,
|
||||
'rank_id' => $position->permission_id,
|
||||
'content' => $validated['content'],
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
->route('staff-applications.index')
|
||||
->with('status', __('Your application has been submitted!'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Community\StaffService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class StaffController extends Controller
|
||||
{
|
||||
public function __construct(private readonly StaffService $staffService) {}
|
||||
|
||||
public function __invoke(): View
|
||||
{
|
||||
$employees = $this->staffService->fetchStaffPositions();
|
||||
|
||||
return view('community.staff', [
|
||||
'employees' => $employees,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Community\Staff\WebsiteOpenPosition;
|
||||
use App\Models\Community\Staff\WebsiteStaffApplications;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WebsiteTeamApplicationsController extends Controller
|
||||
{
|
||||
public function index(): View
|
||||
{
|
||||
$positions = \App\Models\Community\Staff\WebsiteOpenPosition::query()
|
||||
->where('position_kind', 'team')
|
||||
->whereNotNull('team_id')
|
||||
->with('team')
|
||||
->whereHas('team')
|
||||
->latest()
|
||||
->get();
|
||||
|
||||
$userAppStatuses = [];
|
||||
if (auth()->check()) {
|
||||
$teamIds = $positions->pluck('team_id')->filter()->unique()->all();
|
||||
|
||||
$userAppStatuses = \App\Models\Community\Staff\WebsiteStaffApplications::query()
|
||||
->where('user_id', auth()->id())
|
||||
->whereIn('team_id', $teamIds)
|
||||
->pluck('status', 'team_id')
|
||||
->toArray();
|
||||
}
|
||||
|
||||
return view('community.team-applications', [
|
||||
'positions' => $positions,
|
||||
'userAppStatuses' => $userAppStatuses,
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(WebsiteOpenPosition $position): View
|
||||
{
|
||||
abort_unless($position->position_kind === 'team', 404);
|
||||
|
||||
$position->loadMissing('team');
|
||||
|
||||
return view('community.team-apply', [
|
||||
'position' => $position,
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request, WebsiteOpenPosition $position)
|
||||
{
|
||||
abort_unless($position->position_kind === 'team', 404);
|
||||
|
||||
$request->validate([
|
||||
'content' => ['required', 'string', 'min:10'],
|
||||
]);
|
||||
|
||||
$user = $request->user();
|
||||
|
||||
if ($user->hasAppliedForTeam($position->team_id)) {
|
||||
return back()->withErrors([
|
||||
'content' => __('You have already applied for this team.'),
|
||||
]);
|
||||
}
|
||||
|
||||
WebsiteStaffApplications::create([
|
||||
'user_id' => $user->id,
|
||||
'team_id' => $position->team_id,
|
||||
'content' => $request->string('content'),
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
->route('team-applications.index')
|
||||
->with('status', __('Your application has been submitted!'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Community\TeamService;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WebsiteTeamsController extends Controller
|
||||
{
|
||||
public function __construct(private readonly TeamService $teamService) {}
|
||||
|
||||
public function __invoke(): View
|
||||
{
|
||||
$employees = $this->teamService->fetchTeams();
|
||||
|
||||
return view('community.teams', [
|
||||
'employees' => $employees,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community\Teams;
|
||||
|
||||
use App\Models\Community\Teams\WebsiteTeam;
|
||||
use Illuminate\Contracts\View\View;
|
||||
|
||||
class TeamsController
|
||||
{
|
||||
public function __invoke(): View
|
||||
{
|
||||
$employees = WebsiteTeam::query()
|
||||
->where('hidden_rank', false)
|
||||
->with(['users' => fn ($q) => $q
|
||||
->select(['id', 'username', 'look', 'motto', 'team_id'])
|
||||
->orderBy('username'),
|
||||
])
|
||||
->orderBy('rank_name')
|
||||
->get();
|
||||
|
||||
return view('community.teams', compact('employees'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\RareSearchFormRequest;
|
||||
use App\Models\Community\RareValue\WebsiteRareValue;
|
||||
use App\Models\Community\RareValue\WebsiteRareValueCategory;
|
||||
use App\Models\Game\Furniture\Item;
|
||||
use App\Services\Community\RareValues\RareValueCategoriesService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class WebsiteRareValuesController extends Controller
|
||||
{
|
||||
public function __construct(private readonly RareValueCategoriesService $valueCategoriesService) {}
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
return view('rare-values', [
|
||||
'categories' => $this->valueCategoriesService->fetchCategoriesByPriority(),
|
||||
'categoriesNav' => $this->valueCategoriesService->fetchAllCategories(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function category(int $id): \Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$category = $this->valueCategoriesService->fetchCategoryById($id);
|
||||
|
||||
if (! $category) {
|
||||
return redirect()->back()->withErrors([
|
||||
'message' => __('The entered category does not exist'),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('rare-values', [
|
||||
'categories' => $category,
|
||||
'categoriesNav' => $this->valueCategoriesService->fetchAllCategories(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function search(RareSearchFormRequest $request): \Illuminate\View\View|\Illuminate\Http\RedirectResponse
|
||||
{
|
||||
$searchTerm = $request->input('search');
|
||||
|
||||
$categories = $this->valueCategoriesService->searchCategories($searchTerm);
|
||||
|
||||
if ($categories->isEmpty()) {
|
||||
return redirect()->back()->withErrors([
|
||||
'message' => __('It seems like there were no rares matching your search input'),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('rare-values', [
|
||||
'categories' => $categories,
|
||||
'categoriesNav' => WebsiteRareValueCategory::has('furniture')->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function value(WebsiteRareValue $value): View
|
||||
{
|
||||
$items = Item::with(['user:id,username,look'])
|
||||
->where('item_id', $value->item_id)
|
||||
->get();
|
||||
|
||||
$itemsPerUser = $items->groupBy('user_id')->map(fn ($group) => [
|
||||
'user' => $group->first()->user,
|
||||
'item_count' => $group->count(),
|
||||
]);
|
||||
|
||||
if ((bool) setting('enable_caching')) {
|
||||
Cache::remember('allItems_' . $value->id, setting('cache_timer'), fn () => $items);
|
||||
}
|
||||
|
||||
return view('value', [
|
||||
'value' => $value,
|
||||
'items' => $itemsPerUser,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user