Repository URL to install this package:
|
Version:
0.2.1 ▾
|
<?php namespace Modules\Exams\Entities;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Pingpong\Modules\Exceptions\ModuleNotFoundException;
use Prettus\Repository\Contracts\Presentable;
use Prettus\Repository\Traits\PresentableTrait;
/**
* Modules\Exams\Entities\Answer
*
* @property integer $id
* @property string $title
* @property boolean $is_active
* @property boolean $is_correct
* @property integer $exam_id
* @property integer $question_id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property string $deleted_at
* @property-read \Modules\Exams\Entities\Exam $exam
* @property-read \Modules\Exams\Entities\Question $question
* @property-read \Illuminate\Database\Eloquent\Collection|\Modules\Students\Entities\Student[] $student
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereId($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereTitle($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereIsActive($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereIsCorrect($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereExamId($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereQuestionId($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\Modules\Exams\Entities\Answer whereDeletedAt($value)
* @mixin \Eloquent
*/
class Answer extends Model implements Presentable {
use PresentableTrait,
SoftDeletes;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'answers';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['title', 'is_active', 'is_correct', 'exam_id', 'question_id'];
/**
* Get the exam for the answer
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function exam()
{
return $this->belongsTo('Modules\Exams\Entities\Exam');
}
/**
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function student()
{
return $this->belongsToMany('Modules\Students\Entities\Student')->withPivot(['id', 'exam_id']);
}
/**
* Get the questions for the answer
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function question()
{
return $this->belongsTo('Modules\Exams\Entities\Question');
}
}