Make hours and minutes fields required

This commit is contained in:
Nabeel Shahzad 2019-08-01 13:15:33 -04:00
parent aa57997ff5
commit 63485d5a0f
2 changed files with 5 additions and 5 deletions

View File

@ -39,15 +39,15 @@ class CreatePirepRequest extends FormRequest
$field_rules = Pirep::$rules; $field_rules = Pirep::$rules;
$field_rules['hours'] = 'nullable|integer'; $field_rules['hours'] = 'required|integer';
$field_rules['minutes'] = 'nullable|integer'; $field_rules['minutes'] = 'required|integer';
// Add the validation rules for the custom fields // Add the validation rules for the custom fields
$pirepFieldRepo = app(PirepFieldRepository::class); $pirepFieldRepo = app(PirepFieldRepository::class);
$custom_fields = $pirepFieldRepo->all(); $custom_fields = $pirepFieldRepo->all();
foreach ($custom_fields as $field) { foreach ($custom_fields as $field) {
Log::info('field:', $field->toArray()); // Log::info('field:', $field->toArray());
$field_rules[$field->slug] = $field->required ? 'required' : 'nullable'; $field_rules[$field->slug] = $field->required ? 'required' : 'nullable';
} }

View File

@ -39,8 +39,8 @@ class UpdatePirepRequest extends FormRequest
$field_rules = Pirep::$rules; $field_rules = Pirep::$rules;
$field_rules['hours'] = 'nullable|integer'; $field_rules['hours'] = 'required|integer';
$field_rules['minutes'] = 'nullable|integer'; $field_rules['minutes'] = 'required|integer';
// Add the validation rules for the custom fields // Add the validation rules for the custom fields
$pirepFieldRepo = app(PirepFieldRepository::class); $pirepFieldRepo = app(PirepFieldRepository::class);