Skip to content

Commit 8159810

Browse files
refactor(Commands): reduce indent and more readability
1 parent a1d6339 commit 8159810

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Commands/MakeEnum.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ public function handle(): void
3737

3838
$enums = [];
3939
foreach ($columns as $_column) {
40-
if ($_column->DATA_TYPE == 'enum') {
41-
$enumClassName = Str::studly(Str::singular(ucfirst(Str::camel($_column->TABLE_NAME))) . '_' . $_column->COLUMN_NAME) . 'Enum';
42-
$enums[$enumClassName] = array_filter(explode(',', str_replace(['enum(', '\'', ')'], ['', '', ''], $_column->COLUMN_TYPE)));
43-
$filenameWithPath = $this->relativeEnumsPath . $enumClassName . '.php';
44-
$this->checkDelete($filenameWithPath, $enumClassName, 'Enum');
40+
41+
if ($_column->DATA_TYPE !== 'enum') {
42+
continue;
4543
}
44+
45+
$enumClassName = Str::studly(Str::singular(ucfirst(Str::camel($_column->TABLE_NAME))) . '_' . $_column->COLUMN_NAME) . 'Enum';
46+
$enums[$enumClassName] = array_filter(explode(',', str_replace(['enum(', '\'', ')'], ['', '', ''], $_column->COLUMN_TYPE)));
47+
$filenameWithPath = $this->relativeEnumsPath . $enumClassName . '.php';
48+
$this->checkDelete($filenameWithPath, $enumClassName, 'Enum');
4649
}
4750

4851
$attributeStub = file_get_contents($this->enumStubPath . 'attribute.stub');

0 commit comments

Comments
 (0)