-
Notifications
You must be signed in to change notification settings - Fork 902
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
[Bug] uploader: overwrite field when update model #5711
Comments
Hello there! Thanks for opening your first issue on this repo! Just a heads-up: Here at Backpack we use GitHub Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that. Backpack communication channels:
Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch. Thank you! -- |
Based on the information provided in your bug report, it appears you're experiencing an issue with the image field being set to NULL unexpectedly when updating an article's view count. This seems to be a potential bug in Backpack CRUD. Let's analyze the situation:
CRUD::addField([
'name' => 'image',
'label' => 'Image',
'type' => 'image',
'withFiles' => [
'disk' => 'public',
'path' => 'storage/images'
],
'tab' => 'Images'
]);
$article = Article::ofSlug($request->route('article'))->firstOrFail();
$article->update([
'views' => $article->views + 1
]); The unexpected behavior you're seeing where the image is set to NULL every 16th request is not normal and could indeed be a bug. There's a known issue in Backpack CRUD related to image fields and updates, as mentioned in this GitHub issue. The issue describes a problem with repeatable fields containing image subfields, but it's possible that your problem is related. Additionally, there have been other image-related issues reported, such as this one which involved problems with translated image attributes. Given that you're using the latest versions of Backpack CRUD (6.7.41) and Laravel (11.28.1.0), it's possible that this is a new bug that hasn't been reported yet. To troubleshoot this issue:
It's also worth noting that you're using Laravel Octane with RoadRunner, which could potentially introduce complexities in how the application state is managed between requests. Make sure to test if the issue persists without Octane to isolate whether it's a Backpack-specific problem or related to the Octane setup. If you need further assistance or if the problem continues after trying these steps, I recommend reaching out to the Backpack community or creating a new GitHub issue for more targeted support. Relevant sources: Github Issue (open): [Bug] CRUD Repeatable field with sub field image. Use withFiles param path broken file after update model. |
Hi, In general fillable fields are updated by Laravel, retrieving them automatically when you update the model.
what is really strange is that your image column on the database changes its value to NULL at a certain point. |
Hello @tjslash Can you share full Model and FrontController to replicate the issue. Cheers. |
Bug report
What I did
CRUD article controller with field:
and a FrontController file:
What I expected to happen
The count of views should be increase.
What happened
Views has been increase successful. But each 16th request: image set is NULL;
Query log:
Is it a bug in the latest version of Backpack?
Yes.
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:Octane with RoadRunner:
The text was updated successfully, but these errors were encountered: