@@ -514,15 +514,15 @@ The `array_wrap` function will wrap the given value in an array. If the given va
514
514
<a name =" method-data-fill " ></a >
515
515
#### ` data_fill() ` {#collection-method}
516
516
517
- The ` data_fill ` function will fill data in the target array or object where needed, using "dot" notation:
517
+ The ` data_fill ` function will fill data in the target array or object using "dot" notation:
518
518
519
519
$data = ['foo' => 'bar'];
520
520
521
521
data_fill($data, 'baz', 'boom')
522
522
523
523
// ['foo' => 'bar', 'baz' => 'boom']
524
524
525
- This function also accepts asterisks as wildcards, and will fill into the target accordingly:
525
+ This function also accepts asterisks as wildcards and will fill the target accordingly:
526
526
527
527
$data = [
528
528
'posts' => [
@@ -533,14 +533,14 @@ This function also accepts asterisks as wildcards, and will fill into the target
533
533
]
534
534
];
535
535
536
- data_fill($data,'posts.comments.*.name','No name ');
536
+ data_fill($data,'posts.comments.*.name', 'N/A ');
537
537
538
538
/*
539
539
[
540
540
'posts' => [
541
541
'comments' => [
542
542
['name' => 'Taylor'],
543
- ['name' => 'No name ']
543
+ ['name' => 'N/A ']
544
544
],
545
545
]
546
546
];
@@ -557,27 +557,27 @@ The `data_get` function retrieves a value from a nested array or object using "d
557
557
558
558
// ['price' => 100]
559
559
560
- The ` data_get ` function also accepts a default value, which will be returned if the specific key is not found:
560
+ The ` data_get ` function also accepts a default value, which will be returned if the specified key is not found:
561
561
562
562
$value = data_get($data, 'names.john', 'default');
563
563
564
564
<a name =" method-data-set " ></a >
565
565
#### ` data_set() ` {#collection-method}
566
566
567
- The ` data_set ` function sets a value within a deeply nested array or object using "dot" notation:
567
+ The ` data_set ` function sets a value within a nested array or object using "dot" notation:
568
568
569
569
$data = ['products' => ['desk' => ['price' => 100]]];
570
570
571
571
data_set($data, 'products.desk.price', 200);
572
572
573
573
// ['products' => ['desk' => ['price' => 200]]]
574
574
575
- This function also accepts wildcards, and will set values in the target accordingly:
575
+ This function also accepts wildcards and will set values on the target accordingly:
576
576
577
577
$data = [
578
578
'products' => [
579
- ['name' => 'desk1 ', 'price' => 100],
580
- ['name' => 'desk2 ', 'price' => 150],
579
+ ['name' => 'Desk 1 ', 'price' => 100],
580
+ ['name' => 'Desk 2 ', 'price' => 150],
581
581
]
582
582
];
583
583
@@ -586,21 +586,20 @@ This function also accepts wildcards, and will set values in the target accordin
586
586
/*
587
587
[
588
588
'products' => [
589
- ['name'=> 'desk1 ' => 'price' => 200],
590
- ['name'=> 'desk2 ' => 'price' => 200],
589
+ ['name'=> 'Desk 1 ' => 'price' => 200],
590
+ ['name'=> 'Desk 2 ' => 'price' => 200],
591
591
]
592
592
];
593
593
*/
594
594
595
- By default, any existing values are overwritten. If you wish only set a value if it doesn't exist, you may pass ` false ` as the third parameter:
595
+ By default, any existing values are overwritten. If you wish to only set a value if it doesn't exist, you may pass ` false ` as the third parameter:
596
596
597
597
$data = ['products' => ['desk' => ['price' => 100]]];
598
598
599
599
data_set($data, 'products.desk.price', 200, false);
600
600
601
601
// ['products' => ['desk' => ['price' => 100]]]
602
602
603
-
604
603
<a name =" method-head " ></a >
605
604
#### ` head() ` {#collection-method}
606
605
@@ -1104,7 +1103,7 @@ The `broadcast` function [broadcasts](/docs/{{version}}/broadcasting) the given
1104
1103
<a name =" method-blank " ></a >
1105
1104
#### ` blank() ` {#collection-method}
1106
1105
1107
- The ` blank ` function returns whether the given value is blank":
1106
+ The ` blank ` function returns whether the given value is " blank":
1108
1107
1109
1108
// true
1110
1109
blank('');
@@ -1229,7 +1228,7 @@ The `factory` function creates a model factory builder for a given class, name,
1229
1228
<a name =" method-filled " ></a >
1230
1229
#### ` filled() ` {#collection-method}
1231
1230
1232
- The ` filled ` function returns whether the given value is not blank":
1231
+ The ` filled ` function returns whether the given value is not " blank":
1233
1232
1234
1233
// true
1235
1234
filled(0);
@@ -1441,19 +1440,19 @@ The `throw_unless` function throws the given exception if a given boolean expres
1441
1440
<a name =" method-transform " ></a >
1442
1441
#### ` transform() ` {#collection-method}
1443
1442
1444
- The ` transform ` function executes a Closure on a given value, if the value is not blank, and returns the result of that Closure:
1443
+ The ` transform ` function executes a Closure on a given value if the value is not [ blank] ( #method-blank ) and returns the result of the Closure:
1445
1444
1446
1445
transform(5, function ($value) {
1447
1446
return $value * 2;
1448
1447
});
1449
1448
1450
1449
// 10
1451
1450
1452
- A default value or Closure may also be passed as the third parameter to the method, which is used if the given value is blank:
1451
+ A default value or Closure may also be passed as the third parameter to the method. This value will be returned if the given value is blank:
1453
1452
1454
1453
transform(null, function ($value) {
1455
1454
return $value * 2;
1456
- }, "Value is blank");
1455
+ }, "The value is blank. ");
1457
1456
1458
1457
<a name =" method-validator " ></a >
1459
1458
#### ` validator() ` {#collection-method}
0 commit comments