Files
nexusphp/app/Models/Topic.php
2024-04-05 22:40:06 +08:00

30 lines
592 B
PHP

<?php
namespace App\Models;
class Topic extends NexusModel
{
protected $fillable = ['userid', 'subject', 'locked', 'forumid', 'firstpost', 'lastpost', 'sticky', 'hlcolor', 'views'];
public function user()
{
return $this->belongsTo(User::class, 'userid');
}
public function forum()
{
return $this->belongsTo(Forum::class. 'forumid');
}
public function firstPost()
{
return $this->belongsTo(Post::class, "firstpost");
}
public function lastPost()
{
return $this->belongsTo(Post::class, "lastpost");
}
}