34 lines
693 B
PHP
34 lines
693 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Question extends Model
|
|
{
|
|
use SoftDeletes;
|
|
use HasFactory;
|
|
protected $fillable = ['form_id', 'type', 'question_text', 'options', 'required'];
|
|
|
|
protected $casts = [
|
|
'options' => 'array',
|
|
'required' => 'boolean',
|
|
];
|
|
|
|
public function form()
|
|
{
|
|
return $this->belongsTo(Form::class);
|
|
}
|
|
|
|
public function responses()
|
|
{
|
|
return $this->hasMany(Response::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|