Creating Simple Quiz Logic in Laravel
<p>These are my Schema Tables</p>

<pre><code>Schema::create('question', function(Blueprint $table) {
            $table-&gt;increments('id');
            $table-&gt;text('title');
            $table-&gt;string('hint')-&gt;nullable();
            $table-&gt;text('explanation')-&gt;nullable();
            $table-&gt;string('referencematerial')-&gt;nullable();
            $table-&gt;string('imagepath')-&gt;nullable();
            $table-&gt;boolean('published')-&gt;default(1);
            $table-&gt;timestamps();
            $table-&gt;softDeletes();
        });

Schema::create('answers', function(Blueprint $table) {
            $table-&gt;increments('id');
            $table-&gt;string('text');
            $table-&gt;boolean('iscorrect')-&gt;nullable();
            $table-&gt;timestamps();
        });
</code></pre>

<p>Here is my Classes for Question and Answer.</p>

<pre><code>class Answer extends Model
{
    protected $table = 'answer';

    public $timestamps = true;

    protected $fillable = array('text', 'iscorrect');

    public function Question()
    {
        return $this-&gt;belongsTo('Question');
    }

}

class Question extends Model
{
    protected $table = 'question';
    public $timestamps = true;

    protected $dates = ['deleted_at'];
    protected $fillable = array('title', 'hint', 'explanation', 'referencematerial', 'imagepath', 'published');


    public function Answer()
    {
        return $this-&gt;hasMany('Answer');
    }

}
</code></pre>

<p>My QuizController </p>

<pre><code>public function index()
{
    $questions = Question::with('answers')-&gt;get();
    return $questions;
}

BadMethodCallException in Builder.php line 2251:
Call to undefined method Illuminate\Database\Query\Builder::answers()
</code></pre>

<p>I have been trying to load the questions and answers on the page. It keeps giving me query builder error. Please feel free to chime into it.</p>