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
belongsTo
andhasMany
relationship methods.
-
Clone or download the repository.
-
Place the
CheckModelRelations
class in yourapp/Console/Commands
directory. -
Register the command in your
App\Console\Kernel.php
file:protected $commands = [ \App\Console\Commands\CheckModelRelations::class, ];
- php artisan check:model-relations {database}