Laravel How is resource routing better optimized for background operations?

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.