Skip to content

Commit 4af5728

Browse files
committed
2025-02-03までの原文変更点反映。
1 parent ffdc446 commit 4af5728

File tree

4 files changed

+438
-130
lines changed

4 files changed

+438
-130
lines changed

original-en/migrations.md

Lines changed: 114 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -396,70 +396,144 @@ The schema builder blueprint offers a variety of methods that correspond to the
396396
}
397397
</style>
398398

399+
<a name="booleans-method-list"></a>
400+
#### Boolean Types
401+
399402
<div class="collection-method-list" markdown="1">
400403

401-
[bigIncrements](#column-method-bigIncrements)
402-
[bigInteger](#column-method-bigInteger)
403-
[binary](#column-method-binary)
404404
[boolean](#column-method-boolean)
405+
406+
</div>
407+
408+
<a name="strings-and-texts-method-list"></a>
409+
#### String & Text Types
410+
411+
<div class="collection-method-list" markdown="1">
412+
405413
[char](#column-method-char)
406-
[dateTimeTz](#column-method-dateTimeTz)
407-
[dateTime](#column-method-dateTime)
408-
[date](#column-method-date)
414+
[longText](#column-method-longText)
415+
[mediumText](#column-method-mediumText)
416+
[string](#column-method-string)
417+
[text](#column-method-text)
418+
[tinyText](#column-method-tinyText)
419+
[longText](#column-method-longText)
420+
421+
</div>
422+
423+
<a name="numbers--method-list"></a>
424+
#### Numeric Types
425+
426+
<div class="collection-method-list" markdown="1">
427+
428+
[bigIncrements](#column-method-bigIncrements)
429+
[bigInteger](#column-method-bigInteger)
409430
[decimal](#column-method-decimal)
410431
[double](#column-method-double)
411-
[enum](#column-method-enum)
412432
[float](#column-method-float)
413-
[foreignId](#column-method-foreignId)
414-
[foreignIdFor](#column-method-foreignIdFor)
415-
[foreignUlid](#column-method-foreignUlid)
416-
[foreignUuid](#column-method-foreignUuid)
417-
[geography](#column-method-geography)
418-
[geometry](#column-method-geometry)
419433
[id](#column-method-id)
420434
[increments](#column-method-increments)
421435
[integer](#column-method-integer)
422-
[ipAddress](#column-method-ipAddress)
423-
[json](#column-method-json)
424-
[jsonb](#column-method-jsonb)
425-
[longText](#column-method-longText)
426-
[macAddress](#column-method-macAddress)
427436
[mediumIncrements](#column-method-mediumIncrements)
428437
[mediumInteger](#column-method-mediumInteger)
429-
[mediumText](#column-method-mediumText)
430-
[morphs](#column-method-morphs)
431-
[nullableMorphs](#column-method-nullableMorphs)
432-
[nullableTimestamps](#column-method-nullableTimestamps)
433-
[nullableUlidMorphs](#column-method-nullableUlidMorphs)
434-
[nullableUuidMorphs](#column-method-nullableUuidMorphs)
435-
[rememberToken](#column-method-rememberToken)
436-
[set](#column-method-set)
437438
[smallIncrements](#column-method-smallIncrements)
438439
[smallInteger](#column-method-smallInteger)
439-
[softDeletesTz](#column-method-softDeletesTz)
440-
[softDeletes](#column-method-softDeletes)
441-
[string](#column-method-string)
442-
[text](#column-method-text)
443-
[timeTz](#column-method-timeTz)
444-
[time](#column-method-time)
445-
[timestampTz](#column-method-timestampTz)
446-
[timestamp](#column-method-timestamp)
447-
[timestampsTz](#column-method-timestampsTz)
448-
[timestamps](#column-method-timestamps)
449440
[tinyIncrements](#column-method-tinyIncrements)
450441
[tinyInteger](#column-method-tinyInteger)
451-
[tinyText](#column-method-tinyText)
452442
[unsignedBigInteger](#column-method-unsignedBigInteger)
453443
[unsignedInteger](#column-method-unsignedInteger)
454444
[unsignedMediumInteger](#column-method-unsignedMediumInteger)
455445
[unsignedSmallInteger](#column-method-unsignedSmallInteger)
456446
[unsignedTinyInteger](#column-method-unsignedTinyInteger)
457-
[ulidMorphs](#column-method-ulidMorphs)
458-
[uuidMorphs](#column-method-uuidMorphs)
447+
448+
</div>
449+
450+
<a name="dates-and-times-method-list"></a>
451+
#### Date & Time Types
452+
453+
<div class="collection-method-list" markdown="1">
454+
455+
[dateTime](#column-method-dateTime)
456+
[dateTimeTz](#column-method-dateTimeTz)
457+
[date](#column-method-date)
458+
[time](#column-method-time)
459+
[timeTz](#column-method-timeTz)
460+
[timestamp](#column-method-timestamp)
461+
[timestamps](#column-method-timestamps)
462+
[nullableTimestamps](#column-method-nullableTimestamps)
463+
[timestampsTz](#column-method-timestampsTz)
464+
[softDeletes](#column-method-softDeletes)
465+
[softDeletesTz](#column-method-softDeletesTz)
466+
[year](#column-method-year)
467+
468+
</div>
469+
470+
<a name="binaries-method-list"></a>
471+
#### Binary Types
472+
473+
<div class="collection-method-list" markdown="1">
474+
475+
[binary](#column-method-binary)
476+
477+
</div>
478+
479+
<a name="object-and-jsons-method-list"></a>
480+
#### Object & Json Types
481+
482+
<div class="collection-method-list" markdown="1">
483+
484+
[json](#column-method-json)
485+
[jsonb](#column-method-jsonb)
486+
487+
</div>
488+
489+
<a name="uuids-and-ulids-method-list"></a>
490+
#### UUID & ULID Types
491+
492+
<div class="collection-method-list" markdown="1">
493+
459494
[ulid](#column-method-ulid)
495+
[ulidMorphs](#column-method-ulidMorphs)
460496
[uuid](#column-method-uuid)
497+
[uuidMorphs](#column-method-uuidMorphs)
498+
[nullableUlidMorphs](#column-method-nullableUlidMorphs)
499+
[nullableUuidMorphs](#column-method-nullableUuidMorphs)
500+
501+
</div>
502+
503+
<a name="spatials-method-list"></a>
504+
#### Spatial Types
505+
506+
<div class="collection-method-list" markdown="1">
507+
508+
[geography](#column-method-geography)
509+
[geometry](#column-method-geometry)
510+
511+
</div>
512+
513+
#### Relationship Types
514+
515+
<div class="collection-method-list" markdown="1">
516+
517+
[foreignId](#column-method-foreignId)
518+
[foreignIdFor](#column-method-foreignIdFor)
519+
[foreignUlid](#column-method-foreignUlid)
520+
[foreignUuid](#column-method-foreignUuid)
521+
[morphs](#column-method-morphs)
522+
[nullableMorphs](#column-method-nullableMorphs)
523+
524+
</div>
525+
526+
<a name="spacifics-method-list"></a>
527+
#### Specialty Types
528+
529+
<div class="collection-method-list" markdown="1">
530+
531+
[enum](#column-method-enum)
532+
[set](#column-method-set)
533+
[macAddress](#column-method-macAddress)
534+
[ipAddress](#column-method-ipAddress)
535+
[rememberToken](#column-method-rememberToken)
461536
[vector](#column-method-vector)
462-
[year](#column-method-year)
463537

464538
</div>
465539

original-en/validation.md

Lines changed: 105 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,11 +1062,36 @@ Instead of passing a date string to be evaluated by `strtotime`, you may specify
10621062

10631063
'finish_date' => 'required|date|after:start_date'
10641064

1065+
For convenience, date based rules may be constructed using the fluent `date` rule builder:
1066+
1067+
use Illuminate\Validation\Rule;
1068+
1069+
'start_date' => [
1070+
'required',
1071+
Rule::date()->after(today()->addDays(7)),
1072+
],
1073+
1074+
The `afterToday` and `todayOrAfter` methods may be used to fluently express the date must be after today or or today or after, respectively:
1075+
1076+
'start_date' => [
1077+
'required',
1078+
Rule::date()->afterToday(),
1079+
],
1080+
10651081
<a name="rule-after-or-equal"></a>
10661082
#### after\_or\_equal:_date_
10671083

10681084
The field under validation must be a value after or equal to the given date. For more information, see the [after](#rule-after) rule.
10691085

1086+
For convenience, date based rules may be constructed using the fluent `date` rule builder:
1087+
1088+
use Illuminate\Validation\Rule;
1089+
1090+
'start_date' => [
1091+
'required',
1092+
Rule::date()->afterOrEqual(today()->addDays(7)),
1093+
],
1094+
10701095
<a name="rule-alpha"></a>
10711096
#### alpha
10721097

@@ -1144,11 +1169,36 @@ While the `bail` rule will only stop validating a specific field when it encount
11441169

11451170
The field under validation must be a value preceding the given date. The dates will be passed into the PHP `strtotime` function in order to be converted into a valid `DateTime` instance. In addition, like the [`after`](#rule-after) rule, the name of another field under validation may be supplied as the value of `date`.
11461171

1172+
For convenience, date based rules may also be constructed using the fluent `date` rule builder:
1173+
1174+
use Illuminate\Validation\Rule;
1175+
1176+
'start_date' => [
1177+
'required',
1178+
Rule::date()->before(today()->subDays(7)),
1179+
],
1180+
1181+
The `beforeToday` and `todayOrBefore` methods may be used to fluently express the date must be before today or or today or before, respectively:
1182+
1183+
'start_date' => [
1184+
'required',
1185+
Rule::date()->beforeToday(),
1186+
],
1187+
11471188
<a name="rule-before-or-equal"></a>
11481189
#### before\_or\_equal:_date_
11491190

11501191
The field under validation must be a value preceding or equal to the given date. The dates will be passed into the PHP `strtotime` function in order to be converted into a valid `DateTime` instance. In addition, like the [`after`](#rule-after) rule, the name of another field under validation may be supplied as the value of `date`.
11511192

1193+
For convenience, date based rules may also be constructed using the fluent `date` rule builder:
1194+
1195+
use Illuminate\Validation\Rule;
1196+
1197+
'start_date' => [
1198+
'required',
1199+
Rule::date()->beforeOrEqual(today()->subDays(7)),
1200+
],
1201+
11521202
<a name="rule-between"></a>
11531203
#### between:_min_,_max_
11541204

@@ -1193,6 +1243,15 @@ The field under validation must be equal to the given date. The dates will be pa
11931243

11941244
The field under validation must match one of the given _formats_. You should use **either** `date` or `date_format` when validating a field, not both. This validation rule supports all formats supported by PHP's [DateTime](https://www.php.net/manual/en/class.datetime.php) class.
11951245

1246+
For convenience, date based rules may be constructed using the fluent `date` rule builder:
1247+
1248+
use Illuminate\Validation\Rule;
1249+
1250+
'start_date' => [
1251+
'required',
1252+
Rule::date()->format('Y-m-d'),
1253+
],
1254+
11961255
<a name="rule-decimal"></a>
11971256
#### decimal:_min_,_max_
11981257

@@ -1242,15 +1301,18 @@ A _ratio_ constraint should be represented as width divided by height. This can
12421301

12431302
'avatar' => 'dimensions:ratio=3/2'
12441303

1245-
Since this rule requires several arguments, you may use the `Rule::dimensions` method to fluently construct the rule:
1304+
Since this rule requires several arguments, it is often more convenient to use use the `Rule::dimensions` method to fluently construct the rule:
12461305

12471306
use Illuminate\Support\Facades\Validator;
12481307
use Illuminate\Validation\Rule;
12491308

12501309
Validator::make($data, [
12511310
'avatar' => [
12521311
'required',
1253-
Rule::dimensions()->maxWidth(1000)->maxHeight(500)->ratio(3 / 2),
1312+
Rule::dimensions()
1313+
->maxWidth(1000)
1314+
->maxHeight(500)
1315+
->ratio(3 / 2),
12541316
],
12551317
]);
12561318

@@ -2196,42 +2258,60 @@ Laravel provides a variety of validation rules that may be used to validate uplo
21962258
],
21972259
]);
21982260

2199-
If your application accepts images uploaded by your users, you may use the `File` rule's `image` constructor method to indicate that the uploaded file should be an image. In addition, the `dimensions` rule may be used to limit the dimensions of the image:
2200-
2201-
use Illuminate\Support\Facades\Validator;
2202-
use Illuminate\Validation\Rule;
2203-
use Illuminate\Validation\Rules\File;
2261+
<a name="validating-files-file-types"></a>
2262+
#### Validating File Types
22042263

2205-
Validator::validate($input, [
2206-
'photo' => [
2207-
'required',
2208-
File::image()
2209-
->min(1024)
2210-
->max(12 * 1024)
2211-
->dimensions(Rule::dimensions()->maxWidth(1000)->maxHeight(500)),
2212-
],
2213-
]);
2264+
Even though you only need to specify the extensions when invoking the `types` method, this method actually validates the MIME type of the file by reading the file's contents and guessing its MIME type. A full listing of MIME types and their corresponding extensions may be found at the following location:
22142265

2215-
> [!NOTE]
2216-
> More information regarding validating image dimensions may be found in the [dimension rule documentation](#rule-dimensions).
2266+
[https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
22172267

22182268
<a name="validating-files-file-sizes"></a>
2219-
#### File Sizes
2269+
#### Validating File Sizes
22202270

22212271
For convenience, minimum and maximum file sizes may be specified as a string with a suffix indicating the file size units. The `kb`, `mb`, `gb`, and `tb` suffixes are supported:
22222272

22232273
```php
2224-
File::image()
2274+
File::types(['mp3', 'wav'])
22252275
->min('1kb')
2226-
->max('10mb')
2276+
->max('10mb');
22272277
```
22282278

2229-
<a name="validating-files-file-types"></a>
2230-
#### File Types
2279+
<a name="validating-files-image-files"></a>
2280+
#### Validating Image Files
22312281

2232-
Even though you only need to specify the extensions when invoking the `types` method, this method actually validates the MIME type of the file by reading the file's contents and guessing its MIME type. A full listing of MIME types and their corresponding extensions may be found at the following location:
2282+
To validate that uploaded files are images, you can use the `File` rule's `image` constructor method. The `File::image()` rule ensures that the file under validation is an image (jpg, jpeg, png, bmp, gif, svg, or webp):
22332283

2234-
[https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types](https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
2284+
```php
2285+
use Illuminate\Support\Facades\Validator;
2286+
use Illuminate\Validation\Rule;
2287+
use Illuminate\Validation\Rules\File;
2288+
2289+
Validator::validate($input, [
2290+
'photo' => [
2291+
'required',
2292+
File::image(),
2293+
],
2294+
]);
2295+
```
2296+
2297+
<a name="validating-files-image-dimensions"></a>
2298+
#### Validating Image Dimensions
2299+
2300+
You may also validate the dimensions of an image. For example, to validate that an uploaded image is at least 1000 pixels wide and 500 pixels tall, you may use the `dimensions` rule:
2301+
2302+
```php
2303+
use Illuminate\Validation\Rule;
2304+
use Illuminate\Validation\Rules\File;
2305+
2306+
File::image()->dimensions(
2307+
Rule::dimensions()
2308+
->maxWidth(1000)
2309+
->maxHeight(500)
2310+
)
2311+
```
2312+
2313+
> [!NOTE]
2314+
> More information regarding validating image dimensions may be found in the [dimension rule documentation](#rule-dimensions).
22352315
22362316
<a name="validating-passwords"></a>
22372317
## Validating Passwords

0 commit comments

Comments
 (0)