post('/_test/page-expired', fn () => abort(419)); }); test('page expired web responses redirect back with a warning', function () { $response = $this->from('/dashboard')->post('/_test/page-expired'); $response ->assertRedirect('/dashboard') ->assertSessionHas('message-warning', 'Your session expired. Please try again.'); }); test('page expired json responses keep the 419 status', function () { $response = $this->postJson('/_test/page-expired'); $response->assertStatus(419); });