Closed Aniket-IN closed 3 weeks ago
Hey there, thanks for reporting this issue.
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?
Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
laravel new bug-report --github="--public"
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.
Thanks!
Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel to open up a new issue if you're still experiencing this.
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: https://github.com/laravel/framework/blob/e052cb83b0bbd73c0359d1ab3770c0d0a1831f23/src/Illuminate/Auth/EloquentUserProvider.php#L99Which 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:![image](https://github.com/laravel/framework/assets/64463116/80e3d697-d488-4bbf-948b-58f6ad22b124)
When I update the User model from any other place:![image](https://github.com/laravel/framework/assets/64463116/febb1876-d5bb-42c9-a5fa-2f748e1bc97c)
Steps To Reproduce
1) Start a new Laravel project with Breeze (Blade) 2) Configure Laravel Scout (any driver) 3) Register a User 4) Login to the dashboard 5) Create the
toSearchableArray()
method in User model, and add add($this->created_at)
6) Now logout from the dashboard it will show the
dd()
output, (Note this 📝) 7) Next, from any other controller try updating a UserUser::find(1)->update(['name' => "Foo Bar"]);
8) Run this code, it will show thedd()
output, (Note this 📝)Compare the output of
Step 6
andStep 8
Those should be different.