@@ -240,10 +240,29 @@ public static function resolveQueriesInCommand(array $args): array
240240 $ model = Janitor::resolveModel ($ model );
241241 }
242242
243- if (! $ model && $ path = get ('path ' )) {
243+ if (! $ modelKey && ! $ model && $ path = get ('path ' )) {
244244 // infer model (page or page draft) from current panel path
245- $ id = trim (str_replace (['panel/pages ' , '+ ' ], ['' , '/ ' ], $ path ), '/ ' );
246- $ model = kirby ()->page ($ id );
245+ if (Str::contains ($ path , 'panel/site ' )) {
246+ $ model = kirby ()->site ();
247+ } elseif (Str::contains ($ path , 'panel/pages ' )) {
248+ $ id = trim (str_replace (['panel/pages ' , '+ ' ], ['' , '/ ' ], $ path ), '/ ' );
249+ $ model = kirby ()->page ($ id );
250+ $ args [] = '--page ' ;
251+ $ args [] = $ model ->uuid ()?->toString() ?? $ model ->id ();
252+ } elseif (Str::contains ($ path , 'panel/users ' )) {
253+ $ id = trim (str_replace (['panel/users ' , '+ ' ], ['' , '/ ' ], $ path ), '/ ' );
254+ $ model = kirby ()->user ($ id );
255+ $ args [] = '--user ' ;
256+ $ args [] = $ model ->uuid ()?->toString() ?? $ model ->id ();
257+ } elseif (Str::contains ($ path , 'panel/account ' )) {
258+ // $id = trim(str_replace(['panel/account', '+'], ['', '/'], $path), '/');
259+ $ model = kirby ()->user ();
260+ $ args [] = '--user ' ;
261+ $ args [] = $ model ->uuid ()?->toString() ?? $ model ->id ();
262+ }
263+
264+ $ args [] = '--model ' ;
265+ $ args [] = $ model ->uuid ()?->toString() ?? $ model ->id ();
247266 }
248267
249268 $ args = array_map (function ($ value ) use ($ model ) {
0 commit comments