V
V
VicTHOR2020-11-30 12:08:03
Laravel
VicTHOR, 2020-11-30 12:08:03

What is the best way to group and process the result of the sample?

There is a table of companies, the company does not have a unique name.
There are such routes

companies/
companies/prefix-{name_slug}
companies/{company:slug}
In the first route there is a list of all companies using the paginate()and method links()
In the second route there is a list of those companies whose names match (the name is transliterated in the field name_slug)
The third route is the page of a specific company, the slug is unique.

How in the first route to make it so that companies with a unique name at the moment would refer to the third route, and companies with the same name grouped by name and referred to the second one?

The fact is that there will be millions of digs, if I just get all the companies and group them using php methods, creating the necessary links there, the table can fly out of memory during the selection and all this will take a very long time. I don't know how to approach.

UPD:
You can create a link field, shift the logic to its generation and the selection will be standard, but at the stage of creating a company, you will need to regenerate it after all companies, which is somehow bold, are there any other options?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question