Welcome Guest, Not a member yet? Register   Sign In
Mutli Application Calling Model From Shared Site In Single Installation Codeigniter 4
#5

(11-16-2022, 09:38 PM)iRedds Wrote: 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
'Source\Models' => 'path/to/app/Models/'

// change class to
namespace Source\Models;
classSettings { }

// And in both applications call 
= new \Source\Models\Settings(). 

In general, it is better to move the model into a separate module, which can be connected in both applications.

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.
Reply


Messages In This Thread
RE: Mutli Application Calling Model From Shared Site In Single Installation Codeigniter 4 - by dennz.liu - 11-16-2022, 09:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB