Prechádzať zdrojové kódy

Form::action方法设置参数自动拼接路由前缀

jqh 5 rokov pred
rodič
commit
3d904691c6
2 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 1 1
      src/Form/Builder.php
  2. 1 1
      src/Widgets/Form.php

+ 1 - 1
src/Form/Builder.php

@@ -403,7 +403,7 @@ class Builder
     public function action($action = null)
     {
         if ($action !== null) {
-            $this->action = $action;
+            $this->action = admin_url($action);
 
             return;
         }

+ 1 - 1
src/Widgets/Form.php

@@ -186,7 +186,7 @@ class Form implements Renderable
             return $this->getHtmlAttribute('action');
         }
 
-        return $this->setHtmlAttribute('action', $action);
+        return $this->setHtmlAttribute('action', admin_url($action));
     }
 
     /**