Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //IT SHOULD BE INSIDE YOUR MEHTOD
- //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 New record into database
Add Comment
Please, Sign In to add comment