<?php
namespace Koselig\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Koselig\Support\Wordpress;
use Watson\Rememberable\Rememberable;
class Term extends Model
{
use Rememberable;
public $timestamps = false;
protected $primaryKey = 'term_id';
protected $table = DB_PREFIX . 'terms';
protected $rememberFor;
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
if (Wordpress::multisite() && (Wordpress::getSiteId() !== 0 && Wordpress::getSiteId() !== 1)) {
$this->setTable(DB_PREFIX . Wordpress::getSiteId() . '_terms');
}
if (config('wordpress.caching')) {
$this->rememberFor = config('wordpress.caching');
} else {
unset($this->rememberFor);
}
}
public function taxonomy()
{
return $this->hasMany(TermTaxonomy::class, 'term_id');
}
}