I don't understand what you are trying to accomplish, can you give a better example?
Make Laravel (and Livewire) think we're in the past
I'm working very heavily with dates and while developing, would like to have the app think we're in a past date so that I can use the app and see what it would look like. Mind you that I know how to do this on my unit tests and that works just fine, but I'd like to be able to actually use the app normally.
Things I've tried:
Adding a middleware with something like this:
$knownDate = Carbon::create(config('app.fixed_date'));
Carbon::setTestNow($knownDate);
This kind of works but breaks anything that has a form because the CSRF token is validated against the real date, not the one provided by Carbon:now(). This also breaks Livewire for the same reason.
So I tried completely removing the CSRF middleware and any mentions to @csrf but for some reason Laravel will not let me log in anymore (I'm using a stock Jetstream starting scaffolding with Laravel 10). This also seems like a pain in the butt to do every time I wish to test in this way.
I suspect the key here is to force Laravel's CSRF token generation to use my fake date but I can't figure it out. Any ideas on this or any other potential solutions would be very welcome!
Please or to participate in this conversation.