major ui updates
This commit is contained in:
@@ -10,20 +10,18 @@ final class TicketReferenceService
|
||||
{
|
||||
/**
|
||||
* Build the next human-readable ticket reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function next(): string
|
||||
{
|
||||
$year = now()->format('Y');
|
||||
$prefix = 'HD-' . $year . '-';
|
||||
$prefix = 'HD-'.$year.'-';
|
||||
$last = Ticket::query()
|
||||
->where('reference', 'like', $prefix . '%')
|
||||
->where('reference', 'like', $prefix.'%')
|
||||
->latest('id')
|
||||
->value('reference');
|
||||
|
||||
$next = $last ? ((int) substr((string) $last, -5)) + 1 : 1;
|
||||
|
||||
return $prefix . str_pad((string) $next, 5, '0', STR_PAD_LEFT);
|
||||
return $prefix.str_pad((string) $next, 5, '0', STR_PAD_LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user