Skip to content

Commit 3e3e628

Browse files
author
Tortue Torche
committed
Fix @content_tag_for Blade directives compatibility with array.
1 parent 092f059 commit 3e3e628

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Efficiently/JqueryLaravel/BladeExtensions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function registerContentTags()
104104
$replacement = <<<EOT
105105
<?php
106106
\${$recordName}Record = $record;
107-
if (! is_a(\${$recordName}Record, "\IteratorAggregate")) {
107+
if (! is_array(\${$recordName}Record) && ! is_a(\${$recordName}Record, "\IteratorAggregate")) {
108108
\${$recordName}Record = new \Illuminate\Support\Collection([\${$recordName}Record]);
109109
}
110110
\${$recordIndex} = -1;// -1 because we increment index at the beginnning of the loop

tests/JqlBladeExtensionsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testContentTagFor()
8282
$expect = <<<EOT
8383
<?php
8484
\$projectRecord = \$project;
85-
if (! is_a(\$projectRecord, "\IteratorAggregate")) {
85+
if (! is_array(\$projectRecord) && ! is_a(\$projectRecord, "\IteratorAggregate")) {
8686
\$projectRecord = new \Illuminate\Support\Collection([\$projectRecord]);
8787
}
8888
\$projectIndex = -1;// -1 because we increment index at the beginnning of the loop
@@ -121,7 +121,7 @@ public function testContentTagForWithOptions()
121121
$expect = <<<EOT
122122
<?php
123123
\$projectRecord = \$project;
124-
if (! is_a(\$projectRecord, "\IteratorAggregate")) {
124+
if (! is_array(\$projectRecord) && ! is_a(\$projectRecord, "\IteratorAggregate")) {
125125
\$projectRecord = new \Illuminate\Support\Collection([\$projectRecord]);
126126
}
127127
\$projectIndex = -1;// -1 because we increment index at the beginnning of the loop

0 commit comments

Comments
 (0)