I am currently using resource routing, which is indeed very convenient for ordinary additions, deletions, checks and modifications. But some functions are not only adding, deleting, checking and modifying, but also have many small functions. The current solution is to accept a param in the method corresponding to the resource routing, and use this to determine the specific operation (such as asynchronously obtaining relevant information, modifying table associations) class, etc.) and then execute the corresponding code.
But this will cause the resource routing methods of the controller to be bloated and not intuitive. I wonder if there are any other better solutions that can keep the routing table and the controller relatively simple and readable?
I am currently using resource routing, which is indeed very convenient for ordinary additions, deletions, checks and modifications. But some functions are not only adding, deleting, checking and modifying, but also have many small functions. The current solution is to accept a param in the method corresponding to the resource routing, and use this to determine the specific operation (such as asynchronously obtaining relevant information, modifying table associations) class, etc.) and then execute the corresponding code.
But this will cause the resource routing methods of the controller to be bloated and not intuitive. I wonder if there are any other better solutions that can keep the routing table and the controller relatively simple and readable?
You may need something like this: laravel-default-routes
Configure this default route according to README.md, and then you can easily use the module/controller/action
route in other frameworks. And different functions are called for different types of REST-style requests: do + <HTTP_METHOD> + <action>
This corresponds to the function name.