Repository: laravel/framework (php)

Issue:
Method Illuminate\Auth\RequestGuard::getRecallerName does not exist.
<!-- DO NOT THROW THIS AWAY -->
<!-- Fill out the FULL versions with patch versions -->

- Laravel Version: 9.4.1
- Jetstream Version: 2.6.7
- Jetstream Stack: Livewire
- Uses Teams: no
- PHP Version: 8.1.1
- Database Driver & Version: MariaDB-10.4.12

### Description:
Latest working using Laravel version 9.3.1 with jetsream got bug in https://github.com/laravel/jetstream/issues/985, then it fixed by https://github.com/laravel/framework/commit/50b46db563e11ba52a53e3046c23e92878aed395 and bump laravel version to 9.4.0, but then it produces another issue, if user login with "remember me", and leave tab open for a few hours and open again then will get error `Method Illuminate\Auth\RequestGuard::getRecallerName does not exist.`

full stack trace below:
``` 
#0 /www/redacted/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php(336): Illuminate\Auth\RequestGuard->__call()
#1 /www/redacted/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php(44): Illuminate\Auth\AuthManager->__call()
#2 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\AuthenticateSession->handle()
#3 /www/redacted/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#4 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Auth\Middleware\Authenticate->handle()
#5 /www/redacted/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#6 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\View\Middleware\ShareErrorsFromSession->handle()
#7 /www/redacted/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#8 /www/redacted/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
#9 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Session\Middleware\StartSession->handle()
#10 /www/redacted/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#11 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle()
#12 /www/redacted/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Cookie\Middleware\EncryptCookies->handle()
#14 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#15 /www/redacted/vendor/laravel/framework/src/Illuminate/Routing/Router.php(727): Illuminate\Pipeline\Pipeline->then()
#16 /www/redacted/vendor/laravel/framework/src/Illuminate/Routing/Router.php(702): Illuminate\Routing\Router->runRouteWithinStack()
#17 /www/redacted/vendor/laravel/framework/src/Illuminate/Routing/Router.php(666): Illuminate\Routing\Router->runRoute()
#18 /www/redacted/vendor/laravel/framework/src/Illuminate/Routing/Router.php(655): Illuminate\Routing\Router->dispatchToRoute()
#19 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\Routing\Router->dispatch()
#20 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}()
#21 /www/redacted/vendor/livewire/livewire/src/DisableBrowserCache.php(19): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#22 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Livewire\DisableBrowserCache->handle()
#23 /www/redacted/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(60): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#24 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle()
#25 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#26 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#27 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle()
#28 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#29 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle()
#30 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\TrimStrings->handle()
#31 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#32 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle()
#33 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#34 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle()
#35 /www/redacted/vendor/fruitcake/laravel-cors/src/HandleCors.php(38): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#36 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Fruitcake\Cors\HandleCors->handle()
#37 /www/redacted/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#38 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\Http\Middleware\TrustProxies->handle()
#39 /www/redacted/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#40 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\Pipeline\Pipeline->then()
#41 /www/redacted/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter()
#42 /www/redacted/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle()
#43 {main}
```

### Steps To Reproduce:

- Login with  remember me
- leave the tab open and do nothing for a few hours or change last_activity column in table sessions to old timestamp
- refresh the tab
- get error `Method Illuminate\Auth\RequestGuard::getRecallerName does not exist.`

<!-- If possible, please provide a GitHub repository to demonstrate your issue -->
<!-- laravel new bug-report --github="--public" -->


Pull request description:
[9.x] Fix recaller name resolution
Jetstream overrides the default guard so the `getRecallerName` method should be called on it instead of the default one.

This PR fixes #41428 


Patch:
diff --git a/src/Illuminate/Collections/Collection.php b/src/Illuminate/Collections/Collection.php
index b8ba7a1aef..893e329d53 100644
--- a/src/Illuminate/Collections/Collection.php
+++ b/src/Illuminate/Collections/Collection.php
@@ -856,7 +856,7 @@ public function nth($step, $offset = 0)
     /**
      * Get the items with the specified keys.
      *
-     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>  $keys
+     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string  $keys
      * @return static
      */
     public function only($keys)
diff --git a/src/Illuminate/Collections/Enumerable.php b/src/Illuminate/Collections/Enumerable.php
index 74e9046d11..73f31efb6e 100644
--- a/src/Illuminate/Collections/Enumerable.php
+++ b/src/Illuminate/Collections/Enumerable.php
@@ -757,7 +757,7 @@ public function nth($step, $offset = 0);
     /**
      * Get the items with the specified keys.
      *
-     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>  $keys
+     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string  $keys
      * @return static
      */
     public function only($keys);
diff --git a/src/Illuminate/Collections/LazyCollection.php b/src/Illuminate/Collections/LazyCollection.php
index ee1221f94a..8244f28aac 100644
--- a/src/Illuminate/Collections/LazyCollection.php
+++ b/src/Illuminate/Collections/LazyCollection.php
@@ -861,7 +861,7 @@ public function nth($step, $offset = 0)
     /**
      * Get the items with the specified keys.
      *
-     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>  $keys
+     * @param  \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string  $keys
      * @return static
      */
     public function only($keys)
diff --git a/src/Illuminate/Session/Middleware/AuthenticateSession.php b/src/Illuminate/Session/Middleware/AuthenticateSession.php
index da4ad7e174..1b3cee37cc 100644
--- a/src/Illuminate/Session/Middleware/AuthenticateSession.php
+++ b/src/Illuminate/Session/Middleware/AuthenticateSession.php
@@ -41,7 +41,7 @@ public function handle($request, Closure $next)
         }
 
         if ($this->guard()->viaRemember()) {
-            $passwordHash = explode('|', $request->cookies->get($this->auth->getRecallerName()))[2] ?? null;
+            $passwordHash = explode('|', $request->cookies->get($this->guard()->getRecallerName()))[2] ?? null;
 
             if (! $passwordHash || $passwordHash != $request->user()->getAuthPassword()) {
                 $this->logout($request);


Test patch:
diff --git a/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php b/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php
index f9bee078d5..0e9001449e 100644
--- a/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php
+++ b/src/Illuminate/Console/Scheduling/ScheduleTestCommand.php
@@ -3,6 +3,7 @@
 namespace Illuminate\Console\Scheduling;
 
 use Illuminate\Console\Command;
+use Illuminate\Support\Str;
 
 class ScheduleTestCommand extends Command
 {
@@ -11,7 +12,7 @@ class ScheduleTestCommand extends Command
      *
      * @var string
      */
-    protected $name = 'schedule:test';
+    protected $signature = 'schedule:test {--name= : The name of the scheduled command to run}';
 
     /**
      * The name of the console command.
@@ -45,7 +46,21 @@ public function handle(Schedule $schedule)
             $commandNames[] = $command->command ?? $command->getSummaryForDisplay();
         }
 
-        $index = array_search($this->choice('Which command would you like to run?', $commandNames), $commandNames);
+        if (empty($commandNames)) {
+            return $this->comment('No scheduled commands have been defined.');
+        }
+
+        if (! empty($name = $this->option('name'))) {
+            $matches = array_filter($commandNames, fn ($commandName) => Str::endsWith($commandName, $name));
+
+            if (count($matches) !== 1) {
+                return $this->error('No matching scheduled command found.');
+            }
+
+            $index = key($matches);
+        } else {
+            $index = array_search($this->choice('Which command would you like to run?', $commandNames), $commandNames);
+        }
 
         $event = $commands[$index];