3 namespace BookStack\Actions;
6 use Illuminate\Database\Eloquent\Relations\MorphTo;
8 class Tag extends Model
10 protected $fillable = ['name', 'value', 'order'];
11 protected $hidden = ['id', 'entity_id', 'entity_type', 'created_at', 'updated_at'];
14 * Get the entity that this tag belongs to.
16 public function entity(): MorphTo
18 return $this->morphTo('entity');
22 * Get a full URL to start a tag name search for this tag name.
24 public function nameUrl(): string
26 return url('/search?term=%5B' . urlencode($this->name) . '%5D');
30 * Get a full URL to start a tag name and value search for this tag's values.
32 public function valueUrl(): string
34 return url('/search?term=%5B' . urlencode($this->name) . '%3D' . urlencode($this->value) . '%5D');