Order of registering modules appears to remove customers relationship from Address class.
Opened this issue · 0 comments
Not sure if this is the correct place to raise the question. I hope the below explanation makes sense.
After installing the demo repository and setting everything up, we noticed that step 1 and step 2 happen during boot of application.
The issue is that after the second module registration Address::class
looses the relationship customers(): BelongsToMany
.
Is this correct?
Step 1
First loads the following module
Konekt\AppShell\Providers\ModuleServiceProvider::boot
and it runs the following lines
use Konekt\Address\Contracts\Address as AddressContract;
use Konekt\AppShell\Models\Address;
$this->concord->registerModel(AddressContract::class, Address::class);
The Konekt\AppShell\Models\Address::class
now has extends Konekt\Address\Models\Address
and has relationships as below:
public function country(): BelongsTo
public function province(): BelongsTo
public function customers(): BelongsToMany
Step 2
Sometimes after the following module load Vanilo\Foundation\Providers\ModuleServiceProvider::boot
use Konekt\Address\Contracts\Address as AddressContract;
use Vanilo\Foundation\Models\Address;
$this->concord->registerModel(AddressContract::class, Address::class, $registerRouteModels);
The Vanilo\Foundation\Models\Address::class
now extends Konekt\Address\Models\Address::class
and has relationships as below:
public function country(): BelongsTo
public function province(): BelongsTo