Forms_Laravel/app/Models/Form.php

29 lines
553 B
PHP
Executable File

<?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);
}
}