Skip to main content

Government and enterprise

A published regulation is cited by its URL. Correcting a typo in its title must not move the document, a repealed record must not quietly become a soft-404, and an amended one must point at what replaced it.

#[Polyslug(source: 'title', immutable: true)] // a published regulation's slug never changes
class Regulation extends Model implements Sluggable
{
use HasPolyslug;

public function polyslugIsGone(): bool
{
return $this->status === 'repealed'; // a repealed record returns 410 Gone
}

public function polyslugSupersededBy(): ?Sluggable
{
return $this->amendment; // an amended record 301s to its successor's canonical URL
}
}
  • immutable: true freezes the slug after first generation. Editing the title afterwards changes nothing about the URL — no new slug, no redirect, no history entry.
  • polyslugIsGone() returns 410 rather than 404. That is a deliberate, fast de-index signal: the document was withdrawn, it is not missing.
  • polyslugSupersededBy() sends a permanent redirect to the amendment, carrying the citation's link equity with it.

Gone and superseded are evaluated before self-heal, so a repealed record answers 410 even when the requested URL is stale.

Setting a slug deliberately

immutable blocks automatic regeneration, not editorial control: setSlug() still writes a slug explicitly when a deliberate correction is authorized.

See also