You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a weird issue, when a user tries to logout from my Laravel Application. Laravel updates the remember_token.
Which results in Scout updating the data on it's index, and I noticed the timestamp format is not always same.
On that update Laravel sets $user->timestamps to false which disables the casting for created_at and updated_at fields.
This line:
Which eventually leads to inconsistant format for the timestamp fields.
Usually the format is like this: 2023-09-05T18:23:38.000000Z but, only on that instance (when Laravel updates the remember_token) the format is like this: 2023-09-05 18:23:38
When Laravel updates the User model on Logout:
When I update the User model from any other place:
Steps To Reproduce
Start a new Laravel project with Breeze (Blade)
Configure Laravel Scout (any driver)
Register a User
Login to the dashboard
Create the toSearchableArray() method in User model, and add a dd($this->created_at)
We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?
Laravel Version
10.45.0
PHP Version
8.2.18
Database Driver & Version
No response
Description
I noticed a weird issue, when a user tries to logout from my Laravel Application. Laravel updates the
remember_token
.Which results in Scout updating the data on it's index, and I noticed the timestamp format is not always same.
On that update Laravel sets
$user->timestamps
tofalse
which disables the casting forcreated_at
andupdated_at
fields.This line:
framework/src/Illuminate/Auth/EloquentUserProvider.php
Line 99 in e052cb8
Which eventually leads to inconsistant format for the timestamp fields.
Usually the format is like this:
2023-09-05T18:23:38.000000Z
but, only on that instance (when Laravel updates theremember_token
) the format is like this:2023-09-05 18:23:38
When Laravel updates the User model on Logout:
When I update the User model from any other place:
Steps To Reproduce
toSearchableArray()
method in User model, and add add($this->created_at)
dd()
output, (Note this 📝)User::find(1)->update(['name' => "Foo Bar"]);
dd()
output, (Note this 📝)Compare the output of
Step 6
andStep 8
Those should be different.
The text was updated successfully, but these errors were encountered: