Files
ticketbeast/app/HashidsTicketCodeGenerator.php
2017-04-01 13:49:04 -04:00

19 lines
358 B
PHP

<?php
namespace App;
class HashidsTicketCodeGenerator implements TicketCodeGenerator
{
private $hashids;
public function __construct($salt)
{
$this->hashids = new \Hashids\Hashids($salt, 6, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
}
public function generateFor($ticket)
{
return $this->hashids->encode($ticket->id);
}
}