I have two tables one is "Question" and Another is "Answer" In question table, I have columns id, question, option1, option2, option3 and answer in the second table have an id,user_id, question_id, answer. I want to match the answer column from two table.
Question model
public function answers()
{
return $this->hasOne('App\answers', 'answer');
}
Answer Model
public function question()
{
return $this->belongsTo('App\Question', 'answer');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire