-
Laravel Version11 PHP Version8.3 Database Driver & VersionMySQL 8 DescriptionI have a traits namely CleanStorage which is handle the file upload update and delete action and clear the file from storage, and also it has a retrieved event which is update the specified attributes with storage URL. But the problem is while I used this trait in User model and tried to log-out and login the attribute is update with like this in the database I don't know this is an issue or not but this issue takes me here from a production application, if there are any better approach to do that then suggest me. 👍 I have attached the trait screenshot and also the usages. Steps To ReproduceJust use the traits and login then upload a image or update the DB columns with a local image path like this |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
BTW I have solved the issue for myself by using this. static::retrieved(function (Model $model) {
foreach ($model->columnsForStorageItems() as $column) {
// update the attribute
$model->setAttribute(
$column,
$model->getStorageUrl($model->getRawOriginal($column))
);
// Sync the original attribute
$model->syncOriginalAttribute($column);
}
}); but maybe I'm doing it in a wrong way and it make me a wrong feeling. |
Beta Was this translation helpful? Give feedback.
-
The issue occurred when the remember token is updating using the But the |
Beta Was this translation helpful? Give feedback.
For now, the solution I used by updating the traits with this method implementation.