//get last record
$record = RecordModel::latest()->first();
$expNum = explode('-', $record->invoiceno);
//check first day in a year
if ( date('l',strtotime(date('Y-01-01'))) ){
$nextInvoiceNumber = date('Y').'-0001';
} else {
//increase 1 with last invoice number
$nextInvoiceNumber = $expNum[0].'-'. $expNum[1]+1;
}
//now add into database $nextInvoiceNumber as a next number.