Skip to content

Commit 3de57df

Browse files
committed
using the placeholder value if nothing is specified in rules on a new variable fixes pterodactyl#564
1 parent b2429f1 commit 3de57df

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
99
* Support for CS:GO as a default service option selection.
1010
* Support for GMOD as a default service option selection.
1111

12+
### Fixed
13+
* Using default value in rules when creating a new variable if the rules is empty.
14+
1215
## v0.6.4 (Courageous Carniadactylus)
1316
### Fixed
1417
* Fixed the console rendering on page load, I guess people don't like watching it load line-by-line for 10 minutes. Who would have guessed...

app/Repositories/VariableRepository.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public function create($option, array $data)
4747
{
4848
$option = ServiceOption::select('id')->findOrFail($option);
4949

50+
// If there is not a rules present let's populate it with the default/placeholder value.
51+
if(!array_key_exists('rules',$data) || empty($data['rules'])){
52+
$data['rules'] = 'required|string|max:20';
53+
}
54+
5055
$validator = Validator::make($data, [
5156
'name' => 'required|string|min:1|max:255',
5257
'description' => 'sometimes|nullable|string',

0 commit comments

Comments
 (0)