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