This commit is contained in:
2025-02-16 21:11:07 +02:00
parent 87bbfc33d3
commit e8d7e6a1c4
253 changed files with 3879 additions and 72 deletions
+15 -1
View File
@@ -2,9 +2,23 @@
namespace App\Models\Forum;
use App\Models\User;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
//
protected $table = 'forum_posts';
protected $fillable = [
'content',
'user_id',
'category_id',
'thread_id',
'topic_id',
];
public function author()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
}
+5
View File
@@ -7,4 +7,9 @@ use Illuminate\Database\Eloquent\Model;
class Thread extends Model
{
protected $table = 'forum_threads';
public function category()
{
return $this->hasOne(Category::class, 'id', 'category_id');
}
}
+5
View File
@@ -8,6 +8,9 @@ class Topic extends Model
{
protected $table = 'forum_topics';
public const STATUS_OPEN = 'open';
public const STATUS_CLOSED = 'closed';
protected $fillable = [
'name',
'slug',
@@ -15,5 +18,7 @@ class Topic extends Model
'category_id',
'thread_id',
'user_id',
'views_no',
'replies_no',
];
}