Artisan's model:show
command does not list inherited relations
#48798
Labels
model:show
command does not list inherited relations
#48798
Laravel Version
10.28.0
PHP Version
8.2.11
Database Driver & Version
No response
Description
I have an abstract model in my code which is inherited by several models. The abstract model has several relations which are intended to be called from the final models.
The problem is that these inherited relations are not shown in Artisan's
model:show
command because of this line:framework/src/Illuminate/Database/Console/ShowModelCommand.php
Line 201 in 61ea0bc
If the method is not declared on the final model class, the method is skipped. I guess this is for performance reason, to avoid checking methods from the framework, for instance from
Illuminate\Database\Eloquent\Model
.Couldn't we reject the method if it is declared in
Illuminate\Database\Eloquent\Model
? Like this, inherited relations are still shown. It could be really handy for relations declared:Steps To Reproduce
php artisan model:show
for this newly created modelThe inherited relation is not shown
The text was updated successfully, but these errors were encountered: