Update Submissions and add fields
This commit is contained in:
@@ -70,28 +70,49 @@ class StoreEntryRequest extends FormRequest
|
||||
$rules['entry_title'] = "nullable|string|max:255";
|
||||
}
|
||||
|
||||
if( section_must_be( 'romhacks', $section ) ){
|
||||
if( section_must_be( ['romhacks', 'lua-scripts'], $section ) ){
|
||||
$rules['modifications'] = 'array|required|min:1';
|
||||
$rules['modifications.*'] = 'integer|exists:modifications,id';
|
||||
} else if( section_must_be( 'utilities', $section ) ){
|
||||
$rules['categories'] = 'array|required|min:1';
|
||||
$rules['categories.*'] = 'integer|exists:categories,id';
|
||||
}
|
||||
|
||||
if( section_must_be( 'utilities', $section ) ){
|
||||
$rules['systems'] = 'array|required|min:1';
|
||||
$rules['systems.*'] = 'integer|exists:systems,id';
|
||||
}
|
||||
|
||||
$rules['version'] = 'required|string|max:50';
|
||||
$rules['release-date'] = 'required|date';
|
||||
$rules['status'] = 'required|integer|exists:statuses,id';
|
||||
if( section_must_not_be( 'utilities', $section ) ){
|
||||
$rules['status'] = 'required|integer|exists:statuses,id';
|
||||
} else {
|
||||
$rules['level'] = 'required|integer|exists:levels,id';
|
||||
}
|
||||
$rules['description'] = 'required|string';
|
||||
|
||||
if( section_must_be( ['romhacks', 'translations' ], $section ) ){
|
||||
$rules['game_selection_mode'] = 'required|string|in:game,platform,none';
|
||||
$gameSelectionMode = $this->input('game_selection_mode') !== '' ? $this->input('game_selection_mode') : 'game';
|
||||
|
||||
if( $gameSelectionMode === 'none' ){
|
||||
// ...
|
||||
} else if( $gameSelectionMode === 'platform' ){
|
||||
$rules['platform_only_id'] = 'required|integer|exists:platforms,id';
|
||||
} else {
|
||||
$rules['game_id'] = 'required_without:new-game-title|nullable|integer|exists:games,id';
|
||||
$rules['new-game-title'] = 'required_without:game_id|nullable|string|max:255';
|
||||
$rules['new-game-platform'] = 'required_with:new-game-title|nullable|integer|exists:platforms,id';
|
||||
$rules['new-game-genre'] = 'required_with:new-game-title|integer|nullable|exists:genres,id';
|
||||
}
|
||||
|
||||
$rules['hashes'] = 'array|required|min:1';
|
||||
$rules['hashes.*.filename'] = 'required|string|max:512';
|
||||
$rules['hashes.*.hash_crc32'] = 'required|string|max:512';
|
||||
$rules['hashes.*.hash_sha1'] = 'required|string|max:512';
|
||||
$rules['hashes.*.verified'] = 'required|string|max:512';
|
||||
if( section_must_be( ['translations', 'romhacks'], $section ) ){
|
||||
$rules['hashes'] = 'array|required|min:1';
|
||||
$rules['hashes.*.filename'] = 'required|string|max:512';
|
||||
$rules['hashes.*.hash_crc32'] = 'required|string|max:512';
|
||||
$rules['hashes.*.hash_sha1'] = 'required|string|max:512';
|
||||
$rules['hashes.*.verified'] = 'required|string|max:512';
|
||||
}
|
||||
|
||||
$rules['languages'] = 'array|required|min:1';
|
||||
$rules['languages.*'] = 'integer|exists:languages,id';
|
||||
|
||||
Reference in New Issue
Block a user