3 namespace BookStack\Actions;
6 use Illuminate\Database\Eloquent\Factories\HasFactory;
7 use Illuminate\Database\Eloquent\Relations\MorphTo;
11 * @property string $name
12 * @property string $value
13 * @property int $order
15 class Tag extends Model
19 protected $fillable = ['name', 'value', 'order'];
20 protected $hidden = ['id', 'entity_id', 'entity_type', 'created_at', 'updated_at'];
23 * Get the entity that this tag belongs to.
25 public function entity(): MorphTo
27 return $this->morphTo('entity');
31 * Get a full URL to start a tag name search for this tag name.
33 public function nameUrl(): string
35 return url('/search?term=%5B' . urlencode($this->name) . '%5D');
39 * Get a full URL to start a tag name and value search for this tag's values.
41 public function valueUrl(): string
43 return url('/search?term=%5B' . urlencode($this->name) . '%3D' . urlencode($this->value) . '%5D');