Events and ticketing
An event gets renamed after the tickets are printed — a sponsor is added, a date moves into the title. The printed QR code cannot change; the URL behind it has to.
#[Polyslug(source: 'name')] // /events/summer-fest_x7Q — renaming the event 301s every old link
class Event extends Model implements Sluggable
{
use HasPolyslug;
}
$qr = $event->shortLink(); // print on the ticket; /go/{token} follows the event's current URL
Two layers cover it:
- The route key itself self-heals. The old
/events/summer-fest_x7Qstill resolves after the rename and301s to the new canonical URL, so links already shared in email and chat keep working. - The short link is stable by construction.
shortLink()returns the same token for the same event and locale forever, and the redirect target is resolved at scan time — which is what makes it safe to commit to print.
Route the shipped controller once:
Route::get('/go/{token}', Polyslug\Http\Controllers\ShortLinkController::class);
After the event
When the event page is retired, polyslugIsGone() returns 410 and
polyslugSupersededBy() points at next year's edition — the QR code on an old poster then
lands on the current event instead of a dead page. See
Gone and superseded content.