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.
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 :)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments