questionnaire-api/app/Models/Question.php

43 lines
732 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Question extends Model
{
use SoftDeletes;
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = [
'updated_at',
'created_at',
'deleted_at'
];
public function section()
{
return $this->belongsTo(Section::class);
}
public function choices()
{
return $this->hasMany(Questionchoice::class);
}
public function creator()
{
return $this->belongsTo(User::class);
}
public function answers()
{
return $this->hasMany(Answer::class);
}
}