This package provides a Laravel Artisan command to analyze your database's foreign key constraints and suggest the necessary relationships (e.g., belongsTo, hasMany) for your Eloquent models.
- Scans your database schema for foreign key constraints.
- Identifies missing relationships in your Eloquent models.
- Suggests the necessary
belongsToandhasManyrelationship methods.
-
Clone or download the repository.
-
Place the
CheckModelRelationsclass in yourapp/Console/Commandsdirectory. -
Register the command in your
App\Console\Kernel.phpfile:protected $commands = [ \App\Console\Commands\CheckModelRelations::class, ];
- php artisan check:model-relations {database}