Skip to content

Commit

Permalink
[9.x] Fixes default attribute value when using enums on model:show (#…
Browse files Browse the repository at this point in the history
…43360)

* fixes default value for enums on `model:show`

* style

Co-authored-by: Jose Rodriguez <jose.rodriguez@zecovery.com>
  • Loading branch information
josecl and Jose Rodriguez authored Jul 22, 2022
1 parent 61770f3 commit 0f53f65
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Illuminate/Foundation/Console/ShowModelCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\Process\Exception\ProcessSignaledException;
use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Process;
use UnitEnum;

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

if ($attribute['default'] !== null) {
$this->components->bulletList(
[sprintf('default: %s', $attribute['default'])],
[sprintf('default: %s', $attribute['default'] instanceof UnitEnum ? $attribute['default']->name : $attribute['default'])],
OutputInterface::VERBOSITY_VERBOSE
);
}
Expand Down

0 comments on commit 0f53f65

Please sign in to comment.