🆙 More fixes 🆙

This commit is contained in:
Remco
2026-01-19 20:43:46 +01:00
parent deed2158ca
commit 7b9849c159
77 changed files with 1084 additions and 13612 deletions
@@ -11,9 +11,10 @@ use Illuminate\View\View;
class LeaderboardController extends Controller
{
/** @var array<int, int> */
protected array $staffIds = [];
public function __construct(private readonly StaffService $staffService): void
public function __construct(private readonly StaffService $staffService)
{
$this->staffIds = $this->staffService->fetchEmployeeIds();
}
@@ -44,6 +45,9 @@ class LeaderboardController extends Controller
]);
}
/**
* @return \Illuminate\Database\Eloquent\Collection<int, UserSetting>
*/
private function retrieveSettings(string $column): \Illuminate\Database\Eloquent\Collection
{
return UserSetting::select('user_id', $column)
@@ -8,7 +8,7 @@ use Illuminate\View\View;
class PhotosController extends Controller
{
public function __construct(private readonly CameraService $cameraService): void {}
public function __construct(private readonly CameraService $cameraService) {}
public function __invoke(): View
{
@@ -11,7 +11,7 @@ use Illuminate\Http\RedirectResponse;
class StaffApplicationsController extends Controller
{
public function __construct(private readonly StaffApplicationService $staffApplicationService): void {}
public function __construct(private readonly StaffApplicationService $staffApplicationService) {}
public function index(): View
{
@@ -29,7 +29,16 @@ class StaffApplicationsController extends Controller
public function store(WebsiteOpenPosition $position, StaffApplicationFormRequest $request): RedirectResponse
{
if ($this->staffApplicationService->hasUserAppliedForPosition($request->user(), $position->permission->id)) {
/** @var \App\Models\User $user */
$user = $request->user();
if ($position->permission === null) {
return back()->withErrors([
'message' => __('Invalid position configuration.'),
]);
}
if ($this->staffApplicationService->hasUserAppliedForPosition($user, $position->permission->id)) {
return back()->withErrors([
'message' => __('You have already applied for this position.'),
]);
@@ -41,7 +50,7 @@ class StaffApplicationsController extends Controller
]);
}
$this->staffApplicationService->storeApplication($request->user(), $position->permission->id, $request->input('content'));
$this->staffApplicationService->storeApplication($user, $position->permission->id, $request->string('content')->toString());
return to_route('staff-applications.index')->with('success', __('Your application has been submitted!'));
}
@@ -8,7 +8,7 @@ use Illuminate\View\View;
class StaffController extends Controller
{
public function __construct(private readonly StaffService $staffService): void {}
public function __construct(private readonly StaffService $staffService) {}
public function __invoke(): View
{
@@ -8,7 +8,7 @@ use Illuminate\View\View;
class WebsiteTeamsController extends Controller
{
public function __construct(private readonly TeamService $teamService): void {}
public function __construct(private readonly TeamService $teamService) {}
public function __invoke(): View
{
@@ -14,7 +14,7 @@ use Illuminate\View\View;
class WebsiteRareValuesController extends Controller
{
public function __construct(private readonly RareValueCategoriesService $valueCategoriesService): void {}
public function __construct(private readonly RareValueCategoriesService $valueCategoriesService) {}
public function index(): View
{
@@ -42,7 +42,7 @@ class WebsiteRareValuesController extends Controller
public function search(RareSearchFormRequest $request): View|RedirectResponse
{
$searchTerm = $request->input('search');
$searchTerm = $request->string('search')->toString();
$categories = $this->valueCategoriesService->searchCategories($searchTerm);
@@ -64,13 +64,18 @@ class WebsiteRareValuesController extends Controller
->where('item_id', $value->item_id)
->get();
$itemsPerUser = $items->groupBy('user_id')->map(fn ($group) => [
'user' => $group->first()->user,
'item_count' => $group->count(),
]);
$itemsPerUser = $items->groupBy('user_id')->map(function ($group) {
/** @var \App\Models\Game\Furniture\Item $firstItem */
$firstItem = $group->first();
return [
'user' => $firstItem->user,
'item_count' => $group->count(),
];
});
if ((bool) setting('enable_caching')) {
Cache::remember('allItems_' . $value->id, setting('cache_timer'), fn () => $items);
Cache::remember('allItems_' . $value->id, (int) setting('cache_timer'), fn () => $items);
}
return view('value', [