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

The attribute [column3] either does not exist or was not retrieved for model #452

Open
jamesRUS52 opened this issue May 16, 2023 · 1 comment

Comments

@jamesRUS52
Copy link
Contributor

all method not flushing cache when new column requested

$m = MyModel::all(['column1','column2']);
$m = MyModel::all(['column1','column2','column3']);
var_dump($m->first()->column3);

show error
Illuminate\Database\Eloquent\MissingAttributeException The attribute [column3] either does not exist or was not retrieved for model

but get method works properly
$m = MyModel::get(['column1','column2']);
$m = MyModel::get(['column1','column2','column3']);
var_dump($m->first()->column3);

no errors

@mikebronner
Copy link
Owner

@jamesRUS52 thanks for reporting this. The all() method is probably not indexing the fields passed in. Would love some help from anyone on this to write up a test case, and perhaps even fix the implementation, if someone has some time.

Thanks! :)

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

No branches or pull requests

2 participants