Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exists property is set to false on soft deleted eloquent model #9794

Closed
wants to merge 1,222 commits into from
Closed

Exists property is set to false on soft deleted eloquent model #9794

wants to merge 1,222 commits into from

Conversation

HolgerW1
Copy link

If you soft delete a model the property exists is set to false which may lead to problems.

Try the following code as a test:

$model->delete();
$model->forceDelete();

Surprisingly the model won't be hard deleted because the first delete call will set the exists property to false thus the second call of forceDelete won't perform anything and the model remains in the DB.

Soft deleting a model should prevent setting the exists property to false because otherwise the model object is in an inconsistent state and any logic relying on this property to check if a model was deleted will fail.

taylorotwell and others added 30 commits June 30, 2015 11:00
[5.1] Call message builder after the message content has been added
Create a helper as a shortcut for method spoofing
This is similar to how the query builder `select` method works and can
probably be replicated throughout to make all the methods work in a
similar way.
[5.1] Allow a string to be passed into the Model::all() method
Just suggestion, and it assumes we use the existing passwords.php file in resources/lang/en
Thank you.
taylorotwell and others added 23 commits July 30, 2015 08:20
[5.1] Fixing docblock arguments
[5.1] Queue migration file name will now contain the right table name
[5.1] Forgot getBindings on whereExists
[5.1] Fix getCountForPagination backup/restore bindings.
…g the query.

We then could use it like this:
```
return $resource->findOrFail($id)
                      ->append(['custom_attribute'])
                      ->toArray();
```
Added public function getCustomDirectives to BladeCompiler
Adds integration test for issue #9794
@HolgerW1
Copy link
Author

Dunno why the pull request went haywire. Please close it.

@HolgerW1 HolgerW1 closed this Jul 31, 2015
@HolgerW1
Copy link
Author

Actual patch can be found here 77f8b4d, feel free to open a new pull request if you're interested.

@GrahamCampbell
Copy link
Member

Can you re-open at 5.1 please @HolgerW1.

@GrahamCampbell
Copy link
Member

You sent to 5.0 instead of 5.1.

@HolgerW1
Copy link
Author

I see, sorry for the mess. Don't know why hub used 5.0 as a base instead of 5.1, never had the 5.0 branch active.
New pull request added #9806, please rename it to whatever fits best.

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.