Forms_Laravel/app/Models/Form.php

29 lines
553 B
PHP
Raw Permalink Normal View History

2024-07-15 06:24:05 +00:00
<?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);
}
}