Mutli Application Calling Model From Shared Site In Single Installation Codeigniter 4 |
How to call models from other multi application site in single installation codeigniter 4 ?
https://stackoverflow.com/q/74457092/6786634 Please help. Could someone help answer my question above ? Is that possible to call or access model from another site in multi application in single installation ? I keep getting class not found even the path is correct. I have ask a clear question in the above link. Please see. Thank You (11-16-2022, 09:39 AM)datamweb Wrote: See, it might help you. I already done the setup. But the problem is I want the secondary site use the main site models. In the link above it is just a setup and didn't show how to call the model from the main site from the secondary site.
To do what you want, your model must have a namespace other than the default one.
By default, models have the \App\Models namespace. PHP Code: // You need to add namespace in application 1 and application 2 configs In general, it is better to move the model into a separate module, which can be connected in both applications. (11-16-2022, 09:38 PM)iRedds Wrote: To do what you want, your model must have a namespace other than the default one. Thank You @iRedds. I update the answer in the https://stackoverflow.com/q/74457092/6786634 I have separate the module. I created a shared/Models folder. So the shared model can be access from both application 1 and 2. Now everything is working. |
Welcome Guest, Not a member yet? Register Sign In |