duanlaiquan8174 2014-04-25 08:40
浏览 30
已采纳

在Laravel的不同机器上查看和控制器

I have got a requirement from a customer that my web UI should not have any direct access to my database. My web app is built in php using the Laravel framework and Eloquent. One option is rewriting the code in my controller and model into a webservice (in any other language be it php or java) and calling the webservice from the UI, but this will involve tremendous work. Is there any way in Laravel where I can move my controller and model to another server and calling the controller from UI via Laravel routes? The view must be on one machine and the model-controller on another machine.

  • 写回答

1条回答 默认 最新

  • dpo60833 2014-04-25 12:17
    关注

    To the best of my knowledge this cannot work. Although Laravel is highly customisable, the work involved in moving your entire application to a new server while keeping the view where they are is extremely too much and possibly won't work.

    Your suggestion to use web services is something to consider but in reality you will be creating a static website in one server which uses API's to talk to Laravel on a other servers. They will not be views and definitely not in blade templates. Remember that you have other UI related dependencies in vendor and public directories.

    My suggestion is to have the DB on a separate server which you can connect to by editing the config files - this is a very normal setup.

    Then if you want you can create some web pages which use the API to talk to Laravel from another server but again I cannot see why this would be needed as the views are still not accessible by anyone other than the server.

    Please let me know if I'm missing something :)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据