Setting up Eloquent relationships in Laravel for existing InnoDB relationships
- by adam
I have an initial migration that sets up two tables (users and projects), with a relationship (innoDB).
$table->foreign('user_id')->references('id')->on('users');
I have two Eloquent models set up, blank except for the relationship:
return $this->has_many('Project');
Do i definitely need to tell eloquent about the relationship in the models and the database? I'd assumed something as comprehensive as Laravel would infer it from the Schema? Is there something I'm missing?