'Laravel 8 - Insert using multiple join and calculation laravel

I want to solve the following problem using one query for example

Questions Table

 id  |  question | correct_answer | point

 1   | "what ..?"| 'test'         | 10
 2   | "what ..?"| 'test'         | 5

Answers Table

id |  question_id | user_id | answers | point


Using Laravel 8 I want to add answers to multiple questions at the same time using join and get scores from the questions table and if user answers match to questions.correct_answer also add its score to answers table use something like code:

DB::table('questions')->join('answers','answers.question_id','=','questions.id')

Thanks in Advance :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source