[BE] ArcadeCRUDController — admin CRUD for arcade games & payout config
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Use ProductCRUDController as the reference for the CRUDController pattern, and add the new /arcadeGames entry to the admin Route::resources array in routes/web.php. The ArcadeGame model (#460) and arcade_games table (#458) are prerequisites, and neither is linked here, so check they exist first. Done means GET /admin/arcadeGames renders, invalid payout_config JSON fails validation, and slug uniqueness per edition holds on create and update.
Written by the indexing model from the issue text.
Description
Context & Objective
Create ArcadeCRUDController — the admin backend for managing arcade games. Admins can create game entries per edition, toggle them on/off, adjust wager limits, and edit the payout_config JSON to tune multipliers without a code deployment.
This controller follows the exact same CRUDController extension pattern as ProductCRUDController.
Files to Create / Modify
- Create:
app/Http/Controllers/ArcadeCRUDController.php - Modify:
routes/web.php— add'/arcadeGames' => ArcadeCRUDController::classto the adminRoute::resourcesarray
Technical Requirements
class ArcadeCRUDController extends CRUDController
{
protected string $model = ArcadeGame::class;
protected string $view = 'ArcadeGames';
protected array $rules = [
'edition_id' => 'required|exists:editions,id',
'slug' => 'required|string|max:64',
'name' => 'required|string|max:255',
'is_active' => 'boolean',
'is_pvp' => 'boolean',
'min_wager' => 'required|integer|min:1',
'max_wager' => 'required|integer|min:1|gte:min_wager',
'daily_win_cap' => 'nullable|integer|min:1',
'payout_config' => 'required|json', // validated as a JSON string
];
protected function updateRules($old): array
{
// Slug must be unique per edition, excluding this record
return array_merge($this->rules, [
'slug' => [
'required', 'string', 'max:64',
Rule::unique('arcade_games')->where('edition_id', request('edition_id'))
->ignore($old->id),
],
]);
}
protected function storeRules(): array
{
return array_merge($this->rules, [
'slug' => [
'required', 'string', 'max:64',
Rule::unique('arcade_games')->where('edition_id', request('edition_id')),
],
]);
}
protected function with(): array
{
return ['editions' => Edition::all()];
}
protected function created(array $new): ?array
{
// payout_config arrives as a JSON string; decode before storing
$new['payout_config'] = json_decode($new['payout_config'], true);
return $new;
}
protected function updated($old, array $new): ?array
{
$new['payout_config'] = json_decode($new['payout_config'], true);
return $new;
}
}
Register in routes/web.php:
Route::resources([
...existing...
'/arcadeGames' => ArcadeCRUDController::class,
...
]);
Acceptance Criteria
-
GET /admin/arcadeGamesrenders the admin index page - Create with valid JSON
payout_configsucceeds; invalid JSON returns validation error - Slug unique-per-edition constraint is enforced on create and update
-
payout_configis stored as a proper JSONB value (not a string) in the database -
is_activeandis_pvpfields are handled as booleans (checkboxes in FE) - All existing admin middleware (
can:admin) applies via the route group
Dependencies
- #458 (arcade_games table)
- #460 (ArcadeGame model)
- Dominant language
- Vue
- Stars
- 12
- Forks
- 1
- Avg merge
- 3d 34m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from semanadeinformatica/website
-
frontend P0
Difficulty 1/5 Under an hour Newbie friendliness 65/100
semanadeinformatica/website#483 ·
-
gamification P1
Difficulty 4/5 3-5 days Newbie friendliness 25/100
semanadeinformatica/website#479 ·
-
frontend gamification P1
Difficulty 3/5 1-2 days Newbie friendliness 62/100
semanadeinformatica/website#478 ·
-
frontend gamification P2
Difficulty 3/5 1-2 days Newbie friendliness 52/100
semanadeinformatica/website#477 ·
-
backend gamification P1
Difficulty 3/5 1-2 days Newbie friendliness 50/100
semanadeinformatica/website#476 ·
All issues in semanadeinformatica/website
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
virtualmin/virtualmin-gpl#1322 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
kind/bug needs-priority needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
konveyor/tackle2-hub#1166 · 1 comment ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
UKGovernmentBEIS/inspect_ai#6268 ·
Maintainers usually reply within 1 day
-
enhancement needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
bherbruck/solvecraft#11246 · 1 comment · 1 reaction ·