Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Saving a single value #33

Open
TheBox193 opened this issue Apr 2, 2014 · 2 comments
Open

Saving a single value #33

TheBox193 opened this issue Apr 2, 2014 · 2 comments

Comments

@TheBox193
Copy link
Contributor

Hey there, seems I am unable to update a single value of a model using standard method per Laravel docs. I'm guessing the overwritten save() doesn't support some of the standard implementation?

$user = User::find(1);
$user->email = '[email protected]';
$user->save();

Found public function setAttribute($key, $value) in the source and attempted using it as well with no luck.

@w3irdrobot
Copy link
Collaborator

I can't recreate the error. This package enables automatic validation. Have you checked to make sure it is passing validation? Try:

dd($user->errors());

@RicardoRamirezR
Copy link
Contributor

If you want to save ONLY this field without validation use

$user->save([], true);

Now, you can add 'sometimes' to the rules in the others fields...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants