-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
A bug with the refresh method (Model class)? #27288
Comments
As evident by gits history, it was made on purpose albeit with no discussion I could quickly find:
Best to ask @themsaid wo did the change. But in any event, it's seems quite deliberate and not like a bug so a change should be discussed on https://github.com/laravel/ideas |
@mfn thanks for explaining! |
@driesvints I think we still need to wait for @themsaid for this one, since he wrote the code (because there is a chance the code needs to be fixed). could you please reopen it? |
@djug I pinged him but you can always reach him on discord etc |
These two methods were designed to have different behavior. This is what I would expect. |
This was made like this so |
Description:
in
Illuminate/Database/Eloquent/Model.php
if we take a look at the
fresh
method we find this at the beginning:which mean if the model is no longer there we just return (
null
?).but the behavior of the
refresh
method is slightly different:in other terms, if we delete the model, and we execute the
fresh()
method on it, we will getnull
, but if we executerefresh()
we will get the model back again, which, if I understand correctly, is not the intended goal of this method.Steps To Reproduce:
if someone could confirm that this is a bug I'll send a MR for it
The text was updated successfully, but these errors were encountered: