29 lines
553 B
PHP
29 lines
553 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
class Form extends Model
|
||
|
{
|
||
|
use HasFactory;
|
||
|
protected $fillable = ['user_id', 'title', 'description', 'ispublished'];
|
||
|
|
||
|
// Define relationships
|
||
|
public function user()
|
||
|
{
|
||
|
return $this->belongsTo(User::class);
|
||
|
}
|
||
|
|
||
|
public function questions()
|
||
|
{
|
||
|
return $this->hasMany(Question::class);
|
||
|
}
|
||
|
|
||
|
public function responses()
|
||
|
{
|
||
|
return $this->hasMany(Response::class);
|
||
|
}
|
||
|
}
|