You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Added 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: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,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Community\Staff;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StaffApplicationFormRequest;
|
||||
use App\Models\Community\Staff\WebsiteOpenPosition;
|
||||
use App\Services\Community\StaffApplicationService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class StaffApplicationsController extends Controller
|
||||
{
|
||||
public function __construct(private readonly StaffApplicationService $staffApplicationService) {}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('community.staff-applications', [
|
||||
'positions' => $this->staffApplicationService->fetchOpenPositions(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(WebsiteOpenPosition $position)
|
||||
{
|
||||
return view('community.staff-applications-apply', [
|
||||
'position' => $position->load('permission'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(WebsiteOpenPosition $position, StaffApplicationFormRequest $request): RedirectResponse
|
||||
{
|
||||
if ($this->staffApplicationService->hasUserAppliedForPosition($request->user(), $position->permission->id)) {
|
||||
return back()->withErrors([
|
||||
'message' => __('You have already applied for this position.'),
|
||||
]);
|
||||
}
|
||||
|
||||
if (! $this->staffApplicationService->isPositionOpenForApplication($position)) {
|
||||
return back()->withErrors([
|
||||
'message' => __('You cannot apply for this position.'),
|
||||
]);
|
||||
}
|
||||
|
||||
$this->staffApplicationService->storeApplication($request->user(), $position->permission->id, $request->input('content'));
|
||||
|
||||
return to_route('staff-applications.index')->with('success', __('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,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,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): View|RedirectResponse
|
||||
{
|
||||
$category = $this->valueCategoriesService->fetchCategoryById($id);
|
||||
|
||||
if (! $category instanceof \App\Models\Community\RareValue\WebsiteRareValueCategory) {
|
||||
return back()->withErrors([
|
||||
'message' => __('The entered category does not exist'),
|
||||
]);
|
||||
}
|
||||
|
||||
return view('rare-values', [
|
||||
'categories' => $category,
|
||||
'categoriesNav' => $this->valueCategoriesService->fetchAllCategories(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function search(RareSearchFormRequest $request): View|RedirectResponse
|
||||
{
|
||||
$searchTerm = $request->input('search');
|
||||
|
||||
$categories = $this->valueCategoriesService->searchCategories($searchTerm);
|
||||
|
||||
if ($categories->isEmpty()) {
|
||||
return 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