This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
yessenia.ramos
Hi, i'm looking suggestions, i've four models related, Products, Set, SetProduct and ProductDelivery.
class Product extends Model{
public $hasMany = [
'set_product' => ['Author\Deliveries\Models\SetProduct', 'softDelete' => true]
];
}
class Set extends Model{
public $hasMany = [
'set_products' => 'Author\Deliveries\Models\SetProduct','delete' => true,'softDelete' => true,'count' => true];
public $hasManyThrough = [
'product_deliveries' => [
'Author\Deliveries\Models\ProductDelivery',
'through' => 'Author\Deliveries\Models\SetProduct'
],
];}
class SetProduct extends Model{
public $hasMany = [
'product_delivery' => ['Author\Deliveries\Models\ProductDelivery', 'softDelete' => true, 'delete' => true]
];
public $belongsTo = [
'set' => ['Author\Deliveries\Models\Set'],
'product' => ['Author\Deliveries\Models\Product',
'scope' => 'SetProduct'
]
];
}
class ProductDelivery extends Model{
public $belongsTo = [
'set_product' => ['Author\Deliveries\Models\SetProduct', 'scope' => 'idProject', 'delete' => 'true']
];
}
In productdelivery form i try to show the more detail it's posible, so i want to show the name of set model that belongs my productdeliver object and the name of product
models/productdelivery/fields.yaml
set_product:
label: 'author.deliveries::lang.label.set'
oc.commentPosition: ''
nameFrom: set
relation: set_product
descriptionFrom: product
list: $/author/deliveries/models/setproduct/ccolumns.yaml
span: auto
required: 1
title: 'author.deliveries::lang.label.recordfinder_set_product'
type: recordfinder
prompt: 'author.deliveries::lang.label.recordfinder_set_product_button'
recordsPerPage: 5
With this configuration it's render:
{"name":"Acceso"} - {"itemcode":"BD11028","name":"BISAGRA INVISIBLE"}
in recordfinder form, my question it's, there is a way to render Acceso-BD11028? this only so that the user is sure of the option that he chose before saving.
Thank you and regards
Last updated
1-1 of 1