Skip to content

Conversation

@bkremenovic
Copy link
Contributor

Hello,
I noticed an issue in commit 4b76635 where a logic was introduced to handle the deleted_at column.

However, in my project, the native Laravel's sanity check was enabled in my AppServiceProvider via Model::preventAccessingMissingAttributes(), as described in this article: https://planetscale.com/blog/laravels-safety-mechanisms.

As a result, the TypesenseEngine.php attempts to access the deleted_at property, which may not be present on the model if the SoftDeletes trait is not used on model class.

This results in an Illuminate\Database\Eloquent\MissingAttributeException with the following message:

The attribute [deleted_at] either does not exist or was not retrieved for model [App\Models\MyTestModel]. {"exception":"[object] (Illuminate\\Database\\Eloquent\\MissingAttributeException(code: 0): The attribute [deleted_at] either does not exist or was not retrieved for model [App\\Models\\MyTestModel]. at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php:478)

Change Summary

I have addressed this issue by adding an additional check, which resolved the problem. Please review my pull request.

PR Checklist

@isidorasuman
Copy link

I would like this MR merged asap. I need it for my project as well. However, I’ll probably create a fork until then.

@arayiksmbatyan arayiksmbatyan merged commit 026187e into typesense:master May 18, 2023
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.

4 participants