File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -709,6 +709,24 @@ public function runningInConsole()
709
709
return $ this ->isRunningInConsole ;
710
710
}
711
711
712
+ /**
713
+ * Determine if the application is running any of the given console commands.
714
+ *
715
+ * @param string|array ...$commands
716
+ * @return bool
717
+ */
718
+ public function runningConsoleCommand (...$ commands )
719
+ {
720
+ if (! $ this ->runningInConsole ()) {
721
+ return false ;
722
+ }
723
+
724
+ return in_array (
725
+ $ _SERVER ['argv ' ][1 ] ?? null ,
726
+ is_array ($ commands [0 ]) ? $ commands [0 ] : $ commands
727
+ );
728
+ }
729
+
712
730
/**
713
731
* Determine if the application is running unit tests.
714
732
*
Original file line number Diff line number Diff line change 38
38
* @method static bool isProduction()
39
39
* @method static string detectEnvironment(\Closure $callback)
40
40
* @method static bool runningInConsole()
41
+ * @method static bool runningConsoleCommand(string|array ...$commands)
41
42
* @method static bool runningUnitTests()
42
43
* @method static bool hasDebugModeEnabled()
43
44
* @method static void registerConfiguredProviders()
You can’t perform that action at this time.
0 commit comments