This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
The idea (I'm hoping) is to allow the assignment of address(es) from the Location create/update backend forms. Please correct me at any point, I am extremely new to October! I have the following table structure which allows addresses to belong to multiple model types.
location:
- id
address:
- id
addressables
- address_id
- addressable_id
- addressable_type
In my Location model
public $morphToMany = [
'addresses' => [
'Vendor\Plugin\Models\Address',
'table' => 'vendor_plugin_addressables',
'name' => 'addressable'
],
];
and in Address model
public $morphedByMany = [
'locations' => [
'Vendor\Plugin\Models\Location',
'table' => 'vendor_plugin_addressables',
'name' => 'addressable'],
];
My Locations controller implements 'Backend.Behaviors.RelationController'
with the following config_relation.yaml
# ===================================
# Relation Behavior Config
# ===================================
addresses:
label: Address
view:
list: $/vendor/plugin/models/address/columns.yaml
manage:
form: $/vendor/plugin/models/address/columns.yaml
pivot:
form: $/vendor/plugin/models/address/fields.yaml
Now I believe going any further will cause an issue due to the lack of Polymorphic support? I'd really appreciate some help with completing this process.
Thanks in advance!
Last updated
1-2 of 2