A
A
Alexey Sklyarov2020-12-16 10:54:47
Laravel
Alexey Sklyarov, 2020-12-16 10:54:47

How to set up routes like in Wordpress?

I am migrating a site from WP to Laravel (DB), the main task is to save all the paths for posts and categories. All categories and posts do not have any "anchor", such as: project.com/categories/{category-name}or project.com/posts/{post-name}.
In this project, all categories have the form: project.com/{category-name}, and posts: project.com/{post-name}.

How is the controller written in general so that categories and posts can be pulled out of the database by slug, moreover, for this to work and provided that there can be a category and a post with the same slug?

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