Closed RoisNewVersion closed 5 years ago
This package store the unique identifier for each autonumber configuration and generate the number based on the config. You should able to generate the number based on authenticated user by adding the user attribute to the config, something like:
public function getAutoNumberOptions()
{
return [
'code' => [
'user' => auth()->user()->id,
'format' => '?',
'length' => 5,
]
];
}
yes i have tried and it works, but i wanna ask how can i change increment value to zero in every single day? for example, today is 0050 and tomorrow should start from 0001 again. thanks.
i tried to add some more data in config like 'data' => date('i')
and it works start counting from beginning, but in auto_number
table will create unique record every minute change, since working with date, it is better to delete or update unique record in auto_number
table to start counting from beginning. thanks.
This package create new record every time the autonumber config changes, that's why it will create unique record every minute if you use date('i')
in the config.
Currently, I'm working on rewriting this package and maybe add the ability to delete/update the old record based on the config.
In the meantime, you need to delete the old record by your self.
okey, thanks for answering my problem, hope you can finish the features soon. thanks.
is there any way to distinguish auto increment base on each authenticated user? for example user id 1 with last increment 0005 and user id 2 with last increment is null, so when user id 2 saving data it will produce 0001 not 0006. thanks.