Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Relation-field-name declaration 07 Feb 2017 22:33 #15002

  • vlemos
  • vlemos's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 295
  • Thank you received: 41
Hello Admin, I am currently working on a project in which everything is separated by company, including pivots. I have found the syncRelation function and added:
	$model->save(array(
		'company_id' => $item->company_id,
		$relation->pivotLocalKey => (int)$this->getId(),
		$relation->pivotForeignKey => (int)$value
	));

It works but lacks the elegance of the code around it. Would like to add a way to pass extra data in the relationship declaration.
	$this->belongsToMany('groups', // name
		'groups', // foreignModelClass
		'id', // localKey
		'id', // foreignKey,
		'usergroups', // pivotModelClass,
		'user_id', // pivotLocalKey
		'group_id', // pivotForeignKey
		'company_id' // pivotCompanyKey ************
	);
Where can I find the relation-field-name declaration?

Thanks
vlemos

Note: final request for today
:cheer:

Please Log in or Create an account to join the conversation.

Relation-field-name declaration 08 Feb 2017 00:52 #15003

  • vlemos
  • vlemos's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
  • Posts: 295
  • Thank you received: 41
Hello Admin, found what I was looking for. Thx

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.074 seconds

  I found "cook" two days ago. Played around with it for a day and then within a day got rid of two legacy applications in IBM Lotus Domino Notes and replaced them with "cook". It was really easy. A piece of cake. Actually it was even easier than cooking. Cooking involves more work than developing with "cook". What can I say about "cook"? Great application great price for what it delivers great forum with a lot of information and fast responses active and friendly community fast forward moving development cycle So what should I say "Monsieur Le Cook"? Keep the good work going it will lead to success. Having become a paying member in the words of Edith Piaf may I say ..... non rien de rien ... je ne regrette rien. Vive La France.
FK (JED)
         

Get Started