Skip to content

Commit 3d8917c

Browse files
committedFeb 24, 2023
Edit command
1 parent 0d7ac62 commit 3d8917c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
 

‎src/Console/GenerateApiResourceCommand.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,15 @@ protected function buildResource(string $class, string $name): string
168168
$properties_length = count($properties);
169169
$count = 0;
170170
foreach ($properties as $property) {
171-
if ($count < $properties_length - 1) {
171+
if ($count === 0) {
172172
$fields .= "'$property' => \$this->$property,\n";
173+
} else if ($count < $properties_length - 1) {
174+
$fields .= "'\t\t\t$property' => \$this->$property,\n";
173175
} else {
174-
$fields .= "'$property' => \$this->$property";
176+
$fields .= "'\t\t\t$property' => \$this->$property";
175177
}
178+
179+
$count++;
176180
}
177181

178182
$stub = $this->files->get($this->stub);

0 commit comments

Comments
 (0)
Please sign in to comment.