Consecutive number handling

Hi, I’m new programming and using yii2.
I have a model like this:
I’d(int),
Consecutive(varchar),
Description (varchar).

For the first time my client handle one type of consecutive(99-9999). But now he wants handle another 2 type of consecutive (99-M-999,99-L-999).

I need your help. I have no idea how to handle 3 different consecutive types. Do I need to use a new model for each new correlative ?. Help me

Hi,
the problem is not clear.

I mean, for now I have this:
Id. Correlative. description

  1.   19-0001.      Something
    
  2.   19-0002.      Something
    

Can I do this?
Id. Correlative. Description

  1. 19-0001.       Something
    
  2.  19-0002.      Something
    
  3.  19-M-0001.  Something
    
  4.  19-M-0002. Something
    
  5.  19-L-001.     Something
    

I don’t now how to increment every correlative in the same model, I think I must create a model for every different correlative

You dont need to create a new model.
You should implement some logic to solve the problem. For example you could:

  1. Get last record from DB;

  2. Explode all the “-” in the value fetched;

  3. Get the index of the exploded string(es.for string NN-S-NNN );

  4. for every index use increment function(+) to count string /character and number.
    Es.

    $s = “A”;
    $s++; ($s is B now)
    //The same is for number;

  5. rebuild your string as your initial pattern (NN-S-NNN)

  6. save the record;
    That is a minimal logic example to solve you problem.
    Try to code the flow!
    Good luck

Thank you, I did it