Skip to content

[9.x] Replace model:show searched value with correct FQCN - #45160

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
bloomlive:fix-model-show-classname
Dec 1, 2022
Merged

[9.x] Replace model:show searched value with correct FQCN#45160
taylorotwell merged 3 commits into
laravel:9.xfrom
bloomlive:fix-model-show-classname

Conversation

@bloomlive

Copy link
Copy Markdown
Contributor

Problem
Currently, while using php artisan model:show the result features the name of the class in the exact way you wrote it.

In PHP, class names as well as function/method names are case-insensitive, but it is considered good practice to them functions as they appear in their declaration. Therefore it makes sense to return the name of the class as intended, however, while drawing the developers attention to it.

Proof of concept
php artisan model:show RUle results in the following:
Screenshot 2022-12-01 at 17 59 55

Explanation of work
This PR checks if the provided model name matches what would be returned and appends searched value while replacing the original with correct casing.

Result
Incorrect casing results in:
Screenshot 2022-12-01 at 17 58 52
Initially correct casing results in:
Screenshot 2022-12-01 at 18 00 38

@taylorotwell
taylorotwell merged commit 1dc5970 into laravel:9.x Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants