barryvdh / laravel-ide-helper

IDE Helper for Laravel
MIT License
14.17k stars 1.16k forks source link

fix belongsTo relation is detected as nullable. #1461

Closed snmatsui closed 7 months ago

snmatsui commented 1 year ago

Summary

In ModelsCommand, belongs to relations are detected as nullable when this column is nullable or has not foreign key constraint.

https://github.com/barryvdh/laravel-ide-helper/blob/master/src/Console/ModelsCommand.php#L841-L842

Now read foreign keys is not reset on model loop. For example. when column x of model A has no foreign key and column x of model B has foreign key, column x of model A may marked as not nullable because column x is recoreded as foreign key by model B.

Type of change

Checklist

barryvdh commented 7 months ago

Thanks, seems like an oversight indeed.