HoshiAI-be/app/Models/Test.php
2025-11-11 21:45:51 +01:00

41 lines
733 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Test extends Model
{
use HasFactory;
protected $fillable = [
'title',
'description',
'category_id',
'author_id',
'closed_at',
];
protected $dates = [
'closed_at',
'created_at',
'updated_at',
];
public function category()
{
return $this->belongsTo(Category::class);
}
public function author()
{
return $this->belongsTo(User::class);
}
public function questions()
{
return $this->belongsToMany(Question::class)
->withTimestamps();
}
}