[Solved] Laravel 6 – `Undefined variable: value` only error in the first time
You could grab the max ‘id’ of the table and add 1 to it without having to grab a whole record: … // validation $newdevicetypeId = DeviceType::max(‘id’) + 1; $GetnewdevicetypeId = sprintf(‘DT%04d’, $newdevicetypeId); // new DeviceType … There is the option of having a model event that can set this particular field after the record … Read more