Attaching a hasOne model to another Laravel/Eloquent model without specifying id
问题 Background Given we have the following two tables where type_id references a row in questionType : question id | type_id | description ---+---------+------------ 1 | 1 | A nice question .. | .. | .. questionType id | name ---+---------------- 1 | Multiple-choice .. | .. with the following Eloquent models: class Question extends Model { public function type() { return $this->hasOne( 'QuestionType', 'id', 'type_id' ); } } class QuestionType extends Model { } Question 1 How can I add a new