You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to add my custom "pivotModel" to Many To Many Polymorphic relation. Here is my Model definitions and migration structure. When I get the collection of categories, the category has \Illuminate\Database\Eloquent\Relations\MorphPivot instead of the pivot model I provided. I found out that here "$using" is always null.
I found out that in Laravel we can specify a custom pivot model with "using()" method like this:
public function users()
{
return $this->belongsToMany('App\User')->using('App\UserRole');
}
Here we call using() Laravel method and set "$using" property. But in OctoberCMS we can not set pivotModel via using() method. And that's why we always have "$using" equal to null here.
Actual behavior
When I get the collection of categories, the category has \Illuminate\Database\Eloquent\Relations\MorphPivot instead of the pivot model I provided.
Reproduce steps
Create application structure like here. And try to set your own custom pivotModel.
October build
October build: 434
The text was updated successfully, but these errors were encountered:
This is because a pivot model for a MorphToMany relationship for Laravel is different from a pivot model used for the belongsToMany relationship. October has not implemented a mirror for this so it won't work in that case.
Closing as it has been over a month since any activity on this occurred and we are trying to figure out what issues are still relevant. If this is still something that you would like to see through to fruition please respond and we can get the ball rolling.
Expected behavior
I want to add my custom "pivotModel" to Many To Many Polymorphic relation. Here is my Model definitions and migration structure. When I get the collection of categories, the category has \Illuminate\Database\Eloquent\Relations\MorphPivot instead of the pivot model I provided. I found out that here "$using" is always null.
I found out that in Laravel we can specify a custom pivot model with "using()" method like this:
Here we call using() Laravel method and set "$using" property. But in OctoberCMS we can not set pivotModel via using() method. And that's why we always have "$using" equal to null here.
Actual behavior
When I get the collection of categories, the category has \Illuminate\Database\Eloquent\Relations\MorphPivot instead of the pivot model I provided.
Reproduce steps
Create application structure like here. And try to set your own custom pivotModel.
October build
October build: 434
The text was updated successfully, but these errors were encountered: