Skip to content
Advertisement

Numeration of documents on PHP

PHP, Laravel 6.0: I can’t write a working static function or a variable for getting numeration of my documents with increment. Every time I create a document it should set its number (Document #1, #2, #3…etc)

I have checked and tried similar questions on StackOverflow but they didn’t work.

I’ve got an Observer Class which should handle the “creating” event and use that function for setting a new number. Here are my tries:

JavaScript

I’d be happy if you help me to solve this problem. Any additional advice, in this case, would be very appreciated since I’m new in PHP & Laravel.

Advertisement

Answer

“Two requests mean two executions of the script, and two distinct memory spaces. At the end of the first request, the first script ends, and all the changes it made in memory are forgotten. The second script starts from scratch, with all the variables having their default value.” from StackOverflow.

Thanks, Jeto and Elias Soares for explainings.

Here is my solution so far:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement