The reason for deleting the session automatically after the post request
This is how I use the session
public function request()
{
session()->put('price', 1000);
session()->get('price') // 1000
}
public function verify()
{
session()->get('price') // null
}
Why does this happen?
I have used it many times before and there have been no problems.
My question is why the session is deleted automatically in the verify method?
It is necessary to know that request is of post type.
and verify of type GET
@Snapey Yes, everything is working well and I have entered the site
Yes, it has been created
There is no cookie blocker and I have even tested with several other browsers and the problem persists
@Snapey this same code with the same structure works in Laravel 9. That's exactly it.
I have tested many different modes, the session is deleted in any case.
even with session()->keep('price'); and or reflash
@Sinnbeck The reconstructions do not work at all, in other words, when the result is return from the request method, there are no more sessions!
By any method of reconstruction
@Snapey This system, as it is known, is a payment service and verify of the payment amount.
When I pass the price statically, everything works correctly and the verification is done successfully.
Returns an exception when the price sent is not the same as the price received.
Now, when I use the session, the second state is created exactly, the price is sent, but in the verify, because it is null and not the same, the exception returns again.
@johndoe220 It's your fault, not Laravel's.
I set up a very small program and you can see it works.
Please check your codes carefully.
If you use a package, make sure that the sessions are not deleted after the requests.
If you want the source code, request that I put it on Github.
As @snapey said, it is unlikely that a bug has occurred at this stage, especially in sessions.