'required|exists:airlines,id', 'flight_number' => 'required', 'dpt_airport_id' => 'required', 'arr_airport_id' => 'required', ]; } $field_rules = Pirep::$rules; $field_rules['hours'] = 'nullable|integer'; $field_rules['minutes'] = 'nullable|integer'; // Add the validation rules for the custom fields $pirepFieldRepo = app(PirepFieldRepository::class); $custom_fields = $pirepFieldRepo->all(); foreach ($custom_fields as $field) { Log::info('field:', $field->toArray()); $field_rules[$field->slug] = $field->required ? 'required' : 'nullable'; } return $field_rules; } }