这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jorgerobles
Copy link
Contributor

You can also…

Enable/Disable/Reset the relations to save. To do this you can use:

$model->withoutRelations('relation name 1', 'relation name 2',…)->save()

…will save all $model relations except the ones passed to the scope.

$model->withRelations('relation name 1', 'relation name 2',…)->save()

…will save only the $model relations passed to the scope

$model->resetRelations()->save()

…will clear the former scopes, and save all the relations of $model

@travisbot
Copy link

This pull request passes (merged 9f889fd into e02942e).

@cebe
Copy link
Member

cebe commented Aug 19, 2012

Can you please explain what this is good for? This behavior already only saves relations that where touched before. No need to specify relations explicitly. Do you have a use case for this?

@jorgerobles
Copy link
Contributor Author

Well, I have been following the project for a while and then saw the #8 issue/feature posted at the project, and I thought that is a piece of code I could contribute. 

At the time it was done, 4 months ago, I thought it was a good idea, but I forgot it for a while until now. Of course, the library has evolved, and I didn't know about how smart it is today.

Anyways, if you think it is not a good idea, dismiss this pull request, but please mark also the #8 as obsolete.

@ghost ghost assigned cebe Sep 22, 2012
@intel352
Copy link

Seems like a legit addition to the ext, fulfills the features requested in #8.
I think it would be good to merge, as it doesn't hurt to have in the ext, and there are likely rare but real situations where this functionality would be needed.

@cebe
Copy link
Member

cebe commented Jan 11, 2013

Hey, sry for not answering for such a long time. I am currently very busy, will try to review this request soon.

@cebe cebe added this to the 1.1.2 milestone Jan 7, 2015
@cebe cebe closed this in 17e7203 Jan 7, 2015
@cebe
Copy link
Member

cebe commented Jan 7, 2015

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants