Skip to content

Commit 25a1eea

Browse files
Fix validation of URLs and translations of validation messages
1 parent 4cde8de commit 25a1eea

File tree

6 files changed

+41
-9
lines changed

6 files changed

+41
-9
lines changed

app/Http/Requests/EventRequest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@ public function rules(): array
5858
'started_at' => [
5959
'nullable',
6060
'date_format:Y-m-d\TH:i',
61+
'required_with:finished_at',
6162
],
6263
'finished_at' => [
6364
'nullable',
6465
'date_format:Y-m-d\TH:i',
6566
],
6667
'website_url' => [
6768
'nullable',
68-
'string',
69+
'url:http,https',
6970
'max:255',
7071
],
7172
'location_id' => [

app/Http/Requests/GenerateGroupsRequest.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,15 @@ public function rules(): array
9393

9494
public function attributes(): array
9595
{
96-
return [
96+
$attributes = [
9797
'booking_option_id' => __('Booking options'),
98+
'exclude_parent_group_id' => __('Exclude members of groups'),
9899
];
100+
101+
foreach (range(0, count($this->input('exclude_parent_group_id')) - 1) as $id) {
102+
$attributes['exclude_parent_group_id.' . $id] = __('Exclude members of groups');
103+
}
104+
105+
return $attributes;
99106
}
100107
}

app/Http/Requests/LocationRequest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ class LocationRequest extends FormRequest
2323
*/
2424
public function rules(): array
2525
{
26-
$rules = [
26+
return [
2727
'name' => [
2828
'nullable',
2929
'string',
3030
'max:255',
3131
],
3232
'website_url' => [
3333
'nullable',
34-
'string',
34+
'url:http,https',
3535
'max:255',
3636
],
37+
...$this->rulesForAddressFields('nullable'),
3738
];
38-
39-
return array_replace($rules, $this->rulesForAddressFields('nullable'));
4039
}
4140
}

app/Http/Requests/OrganizationRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function rules(): array
4747
],
4848
'website_url' => [
4949
'nullable',
50-
'string',
50+
'url:http,https',
5151
'max:255',
5252
],
5353
'location_id' => [

lang/de/validation.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,10 @@
162162
'abilities' => 'Berechtigungen',
163163
'address' => 'Adresse',
164164
'approval_status' => 'Freigabestatus',
165+
'booking_option_id' => 'Anmeldeoption',
166+
'city' => 'Stadt',
165167
'comment' => 'Kommentar',
168+
'country' => 'Land',
166169
'current_password' => 'Derzeitiges Passwort',
167170
'date' => 'Datum',
168171
'date_from' => 'Beginn des Zeitraums',
@@ -171,17 +174,21 @@
171174
'day' => 'Tag',
172175
'description' => 'Beschreibung',
173176
'email' => 'E-Mail-Adresse',
177+
'event_series_id' => 'Teil der Veranstaltungsreihe',
174178
'event_series_type' => 'Art der Veranstaltungsreihe',
175179
'event_type' => 'Art der Veranstaltung',
176180
'expires_at' => 'Ablaufdatum',
177-
'file' => 'Datei',
178181
'file_type' => 'Dateiformat',
182+
'file' => 'Datei',
183+
'finished_at' => 'Enddatum',
179184
'first_name' => 'Vorname',
180185
'groups_count' => 'Anzahl der Gruppen',
181186
'height' => 'Höhe',
182187
'hour' => 'Stunde',
188+
'house_number' => 'Hausnummer',
183189
'last_name' => 'Nachname',
184190
'location_id' => 'Standort',
191+
'maximum_bookings' => 'Maximale Anmeldungen',
185192
'method' => 'Methode',
186193
'minute' => 'Minute',
187194
'month' => 'Monat',
@@ -194,21 +201,27 @@
194201
'password' => 'Passwort',
195202
'password_confirmation' => 'Passwort Bestätigung',
196203
'phone' => 'Telefonnummer',
204+
'postal_code' => 'Postleitzahl',
197205
'price' => 'Preis',
198206
'register_entry' => 'Registereintrag',
199207
'representatives' => 'Vertreter',
208+
'restrictions' => 'Einschränkungen',
200209
'search' => 'Suchbegriff',
201210
'second' => 'Sekunde',
202211
'size' => 'Größe',
212+
'slug' => 'Slug',
203213
'sort' => 'Sortierung',
214+
'started_at' => 'Startdatum',
204215
'status' => 'Status',
216+
'street' => 'Straße',
217+
'terms_and_conditions' => 'AGB',
205218
'thickness' => 'Dicke',
206219
'time' => 'Uhrzeit',
207220
'title' => 'Titel',
208-
'terms_and_conditions' => 'AGB',
209221
'unit' => 'Einheit',
210222
'user_role_id' => 'Benutzerrolle',
211223
'visibility' => 'Sichtbarkeit',
224+
'website_url' => 'Webauftritt',
212225
'width' => 'Breite',
213226
'year' => 'Jahr',
214227
],

lang/en/validation.php

+12
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,21 @@
163163
* As the database scheme is in English, translations work out of the box for the most attributes.
164164
* The other attributes have to be added here.
165165
*/
166+
'booking_option_id' => 'Booking option',
167+
'date_from' => 'start of the period',
168+
'date_until' => 'end of the period',
169+
'event_series_id' => 'Part of the event series',
170+
'expires_at' => 'expiration date',
171+
'finished_at' => 'End date',
166172
'location_id' => 'Location',
173+
'organization_id' => 'Organization',
174+
'parent_event_id' => 'Part of the event',
175+
'parent_event_series_id' => 'Part of the event series',
167176
'parent_organization_id' => 'Parent organization',
177+
'search' => 'search term',
178+
'started_at' => 'Start date',
168179
'user_role_id' => 'User role',
180+
'website_url' => 'website',
169181
],
170182

171183
];

0 commit comments

Comments
 (0)