Skip to content

Commit 0f53f65

Browse files
joseclJose Rodriguez
andauthored
[9.x] Fixes default attribute value when using enums on model:show (#43360)
* fixes default value for enums on `model:show` * style Co-authored-by: Jose Rodriguez <[email protected]>
1 parent 61770f3 commit 0f53f65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Illuminate/Foundation/Console/ShowModelCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Process\Exception\ProcessSignaledException;
1919
use Symfony\Component\Process\Exception\RuntimeException;
2020
use Symfony\Component\Process\Process;
21+
use UnitEnum;
2122

2223
#[AsCommand(name: 'model:show')]
2324
class ShowModelCommand extends Command
@@ -329,7 +330,7 @@ protected function displayCli($class, $database, $table, $attributes, $relations
329330

330331
if ($attribute['default'] !== null) {
331332
$this->components->bulletList(
332-
[sprintf('default: %s', $attribute['default'])],
333+
[sprintf('default: %s', $attribute['default'] instanceof UnitEnum ? $attribute['default']->name : $attribute['default'])],
333334
OutputInterface::VERBOSITY_VERBOSE
334335
);
335336
}

0 commit comments

Comments
 (0)