I am trying to have relations not with primary key but with unique keys. can I do that?
I am trying to have relations not with primary key but with unique keys. can I do that?
In each model, define a primary key for the table as follows:
public function primaryKey()
{
return $dataBaseFieldName;
}
Actually in my database it is set as unique key(and it is also a foreign key of another table’s primary key) and I do not want to change that.
I believe setting it as primary key will give some errors.(Please correct me if i am wrong)
Is there a way other than setting it as primary key?
I would also like to know this.
Oliver
Try to define in the relation itself?
Look into the ‘on’ option.
When i use the ‘on’ option i get a mysql error about not finding a column.