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