Document::where('user_id', $sale->user_id)->max('number') + 1,
create sequence user_document_number;
CREATE TABLE documents(
id SERIAL,
number INT NOT NULL DEFAULT(nextval('user_document_number')),
text text,
PRIMARY KEY(id)
);
insert into documents(text) values('assaassa');