<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RandDVoting extends Model
{
    protected $table = 'randd_votings';

    protected $fillable = [
        'project_id',
        'description',
        'user_id',
        'status',
    ];
    /// relation one to many between Project(NewRandD) and Voting
    public function project()
    {
        return $this->belongsTo(NewRandD::class, 'project_id', 'id');
    }

    /// Relation one to many between user and voting
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function answers()
    {
        return $this->hasMany(RandDVotingPaperAnswer::class, 'vote_id', 'id');
    }
}
