At present, the use of resource routing, for ordinary additions and deletions are indeed very convenient. But there are some functions are not only additions and deletions, as well as a lot of small functions, the current solution is to accept a param in the corresponding method of resource routing, according to this to determine the specific operation (such as asynchronous access to relevant information, modify the table association, etc.) is what to execute the corresponding code.
But this will cause the controller of the several resource routing method is more bloated, it does not seem intuitive, do not know if there is no better solution, can take into account the relative simplicity and readable routing table and Controller?
Reply content:
At present, the use of resource routing, for ordinary additions and deletions are indeed very convenient. But there are some functions are not only additions and deletions, as well as a lot of small functions, the current solution is to accept a param in the corresponding method of resource routing, according to this to determine the specific operation (such as asynchronous access to relevant information, modify the table association, etc.) is what to execute the corresponding code.
But this will cause the controller of the several resource routing method is more bloated, it does not seem intuitive, do not know if there is no better solution, can take into account the relative simplicity and readable routing table and Controller?
You may need this stuff: laravel-default-routes
By configuring this default route in Readme.md, you can easily use routes in the same way as in other frameworks module/controller/action
. and call different functions for different types of rest-style requests: do + +
This corresponds to the function name.