<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use  App\Models\outonum;


class OutonumController extends Controller
{
    public function ControlNumber($ControlNum){
        $outonum = outonum::findorfail($ControlNum);
        $ControlNum = $outonum->prefix . str_pad($outonum->CurrentVal,8,"0",STR_PAD_LEFT);
        $outonum->CurrentVal = $outonum->CurrentVal + 1;
        $outonum->nextVal = $outonum->nextVal + 1;
        $outonum->update();
        return $ControlNum;
    }
}
