34 lines
541 B
PHP
34 lines
541 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
|
||
|
|
class ForumCategory extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'name',
|
||
|
|
'slug',
|
||
|
|
'description',
|
||
|
|
'order',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the threads for the category.
|
||
|
|
*/
|
||
|
|
public function threads()
|
||
|
|
{
|
||
|
|
return $this->hasMany(ForumThread::class, 'category_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the route key for the model.
|
||
|
|
*
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getRouteKeyName()
|
||
|
|
{
|
||
|
|
return 'slug';
|
||
|
|
}
|
||
|
|
}
|