Resource routing is currently in use, which is convenient for common addition, deletion, query, and modification. However, some functions are not only added, deleted, checked, and modified, but also have many small functions. The current solution is to accept a param in the corresponding method of resource routing, determine the specific operation based on this (for example, asynchronously obtaining related information... resource routing is currently in use, which is convenient for common addition, deletion, query, and modification. However, some functions are not only added, deleted, checked, and modified, but also have many small functions. The current solution is to accept a param in the corresponding method of resource routing, based on this, determine the specific operation (such as asynchronously obtaining relevant information, modifying table associations, and so on) and then execute the corresponding code.
However, this will cause the resource routing methods of the controller to be bloated and not intuitive. I wonder if there are other better solutions that can take into account the simplicity and readability of the route table and controller?
Reply content:
Resource routing is currently in use, which is convenient for common addition, deletion, query, and modification. However, some functions are not only added, deleted, checked, and modified, but also have many small functions. The current solution is to accept a param in the corresponding method of resource routing, based on this, determine the specific operation (such as asynchronously obtaining relevant information, modifying table associations, and so on) and then execute the corresponding code.
However, this will cause the resource routing methods of the controller to be bloated and not intuitive. I wonder if there are other better solutions that can take into account the simplicity and readability of the route table and controller?
You may need something like this: laravel-default-routes
Configure the default route according to README. md, and then you can easily useModule/controller/action. In addition, different functions are called for different types of REST-style requests:Do + + This corresponds to the function name.