Thanks for your comment!
I am curious to know what exactly caused the infinite loop when you were testing?
I installed a fresh Laravel 8 installation and used the same code of this article and did not get into any error.
Also yes it's possible to define the key type and incrementing value the way you did, you can even do it directly on the model. I just personally preferred to use a function.
I double-checked the notes and since Laravel 5.6 (https://laravel.com/docs/5.6/releases#laravel-5.6) Ramsey UUID is part of Laravel. I think I will do a small follow-up article where I do not install Ramsey UUID - or I will modify this article.
Thanks again.