phplee
phplee

Hi,

Im building a car leasing plugin which has vehicles and a contracts table (contract name, length, initial payment, month payment etc). I've joining the two tables via a pivot table with pivot fields (length, initial payment, month payment) so that from the vehicles form i can add multiple contracts to each vehicle. problem is when i add a contract. say "12 month" with the relevant pivot data and then try and add another "12 month" to apply another variation using the pivot data, its not there for me to select from the contract pivot list.

Any ideas what this is or is it my relationship somehow

axomat
axomat

I would check everything. You need to have the pivot fields defined on the model relationships, then you need to use relation definitions that refer to the pivot fields in the yaml files. If you still get stuck post more details of the models and also post exactly what is posted to the tables.

phplee
phplee

thanks. its all working fine so don't think I've done anything wrong. just not sure it behaving the way it should.

i just want a vehicle form with a tab called contracts where i can add contract to a list but enter the field values for the contract each time.

Do i just need a toMany relationship? because i simply have vehicles that have many contracts?

thanks for you time

phplee
phplee

I've manage to sort it using a simple toMany relationship now.

thanks again.

1-4 of 4