27 lines
495 B
PHP
27 lines
495 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ForumCategory extends Model
|
|
{
|
|
protected $table = 'forum_categories';
|
|
|
|
protected $fillable = [
|
|
'id', 'name', 'slug', 'parent_id', 'position'
|
|
];
|
|
|
|
public $incrementing = true;
|
|
|
|
public function parent()
|
|
{
|
|
return $this->belongsTo(ForumCategory::class, 'parent_id');
|
|
}
|
|
|
|
public function threads()
|
|
{
|
|
return $this->hasMany(ForumThread::class, 'category_id');
|
|
}
|
|
}
|