In the blade form I get the latest/highest number from the database and add it by 1 when creating new data:
<input type="number" min="0" class="form-control @error('ir_number') is-invalid @enderror" name="ir_number" placeholder="IR Number"
value="{{ DB::table('cases_reports')->get('ir_number', $report->ir_number)->max('ir_number') + 1 }}"/>
It's working as it should, but how can I specify to fill up the gaps between numbers first?
e.g. 1 - 5. create 2, 3, 4 first before creating 6
Also, sometimes the user deletes a record, how can I also fill that deleted number then continue counting?