Explorar el Código

Fix 部分表单验证错误 & 编辑显示错误

兔姬桑 hace 4 años
padre
commit
919de03350

+ 3 - 3
app/Http/Requests/Admin/CertRequest.php

@@ -9,14 +9,14 @@ class CertRequest extends FormRequest
     public function rules()
     {
         $unq_domain = '';
-        if ($this->method() === 'PUT' || $this->method() === 'PATCH') {
+        if (in_array($this->method(), ['PATCH', 'PUT'], true)) {
             $unq_domain = ','.$this->cert->id;
         }
 
         return [
             'domain' => 'required|string|unique:node_certificate,domain'.$unq_domain,
-            'key' => 'string|nullable',
-            'pem' => 'string|nullable',
+            'key'    => 'string|nullable',
+            'pem'    => 'string|nullable',
         ];
     }
 }

+ 1 - 1
app/Http/Requests/Admin/RoleRequest.php

@@ -9,7 +9,7 @@ class RoleRequest extends FormRequest
     public function rules()
     {
         $unq_name = '';
-        if ($this->method() === 'PUT' || $this->method() === 'PATCH') {
+        if (in_array($this->method(), ['PATCH', 'PUT'], true)) {
             $unq_name = ','.$this->role->id;
         }
 

+ 8 - 3
app/Http/Requests/Admin/RuleRequest.php

@@ -8,10 +8,15 @@ class RuleRequest extends FormRequest
 {
     public function rules()
     {
-        return [
-            'type' => 'required|numeric|between:1,4',
-            'name' => 'required|string',
+        $rules = [
+            'name'    => 'required|string',
             'pattern' => 'required|string',
         ];
+
+        if (! in_array($this->method(), ['PATCH', 'PUT'], true)) {
+            $rules = array_merge(['type' => 'required|numeric|between:1,4'], $rules);
+        }
+
+        return $rules;
     }
 }

+ 0 - 1
app/Notifications/AccountActivation.php

@@ -3,7 +3,6 @@
 namespace App\Notifications;
 
 use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Notifications\Messages\MailMessage;
 use Illuminate\Notifications\Notification;
 

+ 67 - 65
composer.lock

@@ -120,16 +120,16 @@
         },
         {
             "name": "composer/ca-bundle",
-            "version": "1.2.8",
+            "version": "1.2.9",
             "source": {
                 "type": "git",
                 "url": "https://github.com/composer/ca-bundle.git",
-                "reference": "8a7ecad675253e4654ea05505233285377405215"
+                "reference": "78a0e288fdcebf92aa2318a8d3656168da6ac1a5"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8a7ecad675253e4654ea05505233285377405215",
-                "reference": "8a7ecad675253e4654ea05505233285377405215",
+                "url": "https://api.github.com/repos/composer/ca-bundle/zipball/78a0e288fdcebf92aa2318a8d3656168da6ac1a5",
+                "reference": "78a0e288fdcebf92aa2318a8d3656168da6ac1a5",
                 "shasum": ""
             },
             "require": {
@@ -138,14 +138,15 @@
                 "php": "^5.3.2 || ^7.0 || ^8.0"
             },
             "require-dev": {
-                "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
+                "phpstan/phpstan": "^0.12.55",
                 "psr/log": "^1.0",
+                "symfony/phpunit-bridge": "^4.2 || ^5",
                 "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.x-dev"
+                    "dev-main": "1.x-dev"
                 }
             },
             "autoload": {
@@ -175,7 +176,7 @@
             "support": {
                 "irc": "irc://irc.freenode.org/composer",
                 "issues": "https://github.com/composer/ca-bundle/issues",
-                "source": "https://github.com/composer/ca-bundle/tree/1.2.8"
+                "source": "https://github.com/composer/ca-bundle/tree/1.2.9"
             },
             "funding": [
                 {
@@ -191,7 +192,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2020-08-23T12:54:47+00:00"
+            "time": "2021-01-12T12:10:35+00:00"
         },
         {
             "name": "dnoegel/php-xdg-base-dir",
@@ -1932,16 +1933,16 @@
         },
         {
             "name": "laravel/framework",
-            "version": "v7.30.1",
+            "version": "v7.30.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/framework.git",
-                "reference": "e73855b18dcfc645c36d2474f437e4e73dd3c11d"
+                "reference": "28481951106e75cf8c5a8b24100059fa327df1ef"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/framework/zipball/e73855b18dcfc645c36d2474f437e4e73dd3c11d",
-                "reference": "e73855b18dcfc645c36d2474f437e4e73dd3c11d",
+                "url": "https://api.github.com/repos/laravel/framework/zipball/28481951106e75cf8c5a8b24100059fa327df1ef",
+                "reference": "28481951106e75cf8c5a8b24100059fa327df1ef",
                 "shasum": ""
             },
             "require": {
@@ -2090,7 +2091,7 @@
                 "issues": "https://github.com/laravel/framework/issues",
                 "source": "https://github.com/laravel/framework"
             },
-            "time": "2020-12-22T17:00:45+00:00"
+            "time": "2021-01-15T15:38:30+00:00"
         },
         {
             "name": "laravel/tinker",
@@ -2427,16 +2428,16 @@
         },
         {
             "name": "league/mime-type-detection",
-            "version": "1.5.1",
+            "version": "1.7.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/thephpleague/mime-type-detection.git",
-                "reference": "353f66d7555d8a90781f6f5e7091932f9a4250aa"
+                "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/353f66d7555d8a90781f6f5e7091932f9a4250aa",
-                "reference": "353f66d7555d8a90781f6f5e7091932f9a4250aa",
+                "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
+                "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
                 "shasum": ""
             },
             "require": {
@@ -2444,8 +2445,9 @@
                 "php": "^7.2 || ^8.0"
             },
             "require-dev": {
-                "phpstan/phpstan": "^0.12.36",
-                "phpunit/phpunit": "^8.5.8"
+                "friendsofphp/php-cs-fixer": "^2.18",
+                "phpstan/phpstan": "^0.12.68",
+                "phpunit/phpunit": "^8.5.8 || ^9.3"
             },
             "type": "library",
             "autoload": {
@@ -2466,7 +2468,7 @@
             "description": "Mime-type detection for Flysystem",
             "support": {
                 "issues": "https://github.com/thephpleague/mime-type-detection/issues",
-                "source": "https://github.com/thephpleague/mime-type-detection/tree/1.5.1"
+                "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0"
             },
             "funding": [
                 {
@@ -2478,7 +2480,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2020-10-18T11:50:25+00:00"
+            "time": "2021-01-18T20:58:21+00:00"
         },
         {
             "name": "maennchen/zipstream-php",
@@ -2840,16 +2842,16 @@
         },
         {
             "name": "mews/captcha",
-            "version": "3.2.4",
+            "version": "3.2.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/mewebstudio/captcha.git",
-                "reference": "616d006be6f53e87b93f6dc0f298fb29ca0b7d6c"
+                "reference": "41a3dac8cf45c8d3176fab7810adf1f5fd1d1802"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/mewebstudio/captcha/zipball/616d006be6f53e87b93f6dc0f298fb29ca0b7d6c",
-                "reference": "616d006be6f53e87b93f6dc0f298fb29ca0b7d6c",
+                "url": "https://api.github.com/repos/mewebstudio/captcha/zipball/41a3dac8cf45c8d3176fab7810adf1f5fd1d1802",
+                "reference": "41a3dac8cf45c8d3176fab7810adf1f5fd1d1802",
                 "shasum": ""
             },
             "require": {
@@ -2860,7 +2862,7 @@
                 "illuminate/session": "~5|^6|^7|^8",
                 "illuminate/support": "~5|^6|^7|^8",
                 "intervention/image": "~2.5",
-                "php": "^7.2"
+                "php": "^7.2|^8.0"
             },
             "require-dev": {
                 "mockery/mockery": "^1.0",
@@ -2907,9 +2909,9 @@
             ],
             "support": {
                 "issues": "https://github.com/mewebstudio/captcha/issues",
-                "source": "https://github.com/mewebstudio/captcha/tree/3.2.4"
+                "source": "https://github.com/mewebstudio/captcha/tree/3.2.5"
             },
-            "time": "2020-12-14T12:34:10+00:00"
+            "time": "2021-01-17T21:30:23+00:00"
         },
         {
             "name": "mews/purifier",
@@ -4086,16 +4088,16 @@
         },
         {
             "name": "psy/psysh",
-            "version": "v0.10.5",
+            "version": "v0.10.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/bobthecow/psysh.git",
-                "reference": "7c710551d4a2653afa259c544508dc18a9098956"
+                "reference": "6f990c19f91729de8b31e639d6e204ea59f19cf3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/7c710551d4a2653afa259c544508dc18a9098956",
-                "reference": "7c710551d4a2653afa259c544508dc18a9098956",
+                "url": "https://api.github.com/repos/bobthecow/psysh/zipball/6f990c19f91729de8b31e639d6e204ea59f19cf3",
+                "reference": "6f990c19f91729de8b31e639d6e204ea59f19cf3",
                 "shasum": ""
             },
             "require": {
@@ -4124,7 +4126,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "0.10.x-dev"
+                    "dev-main": "0.10.x-dev"
                 }
             },
             "autoload": {
@@ -4156,9 +4158,9 @@
             ],
             "support": {
                 "issues": "https://github.com/bobthecow/psysh/issues",
-                "source": "https://github.com/bobthecow/psysh/tree/v0.10.5"
+                "source": "https://github.com/bobthecow/psysh/tree/v0.10.6"
             },
-            "time": "2020-12-04T02:51:30+00:00"
+            "time": "2021-01-18T15:53:43+00:00"
         },
         {
             "name": "ralouphie/getallheaders",
@@ -4632,16 +4634,16 @@
         },
         {
             "name": "stripe/stripe-php",
-            "version": "v7.67.0",
+            "version": "v7.68.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/stripe/stripe-php.git",
-                "reference": "935d2c67912007f6d17b6c08a62050252c509129"
+                "reference": "36b10e1f0e9d973f00f802bbd098bce85d0438e4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/935d2c67912007f6d17b6c08a62050252c509129",
-                "reference": "935d2c67912007f6d17b6c08a62050252c509129",
+                "url": "https://api.github.com/repos/stripe/stripe-php/zipball/36b10e1f0e9d973f00f802bbd098bce85d0438e4",
+                "reference": "36b10e1f0e9d973f00f802bbd098bce85d0438e4",
                 "shasum": ""
             },
             "require": {
@@ -4687,22 +4689,22 @@
             ],
             "support": {
                 "issues": "https://github.com/stripe/stripe-php/issues",
-                "source": "https://github.com/stripe/stripe-php/tree/v7.67.0"
+                "source": "https://github.com/stripe/stripe-php/tree/v7.68.0"
             },
-            "time": "2020-12-09T19:00:34+00:00"
+            "time": "2021-01-15T00:38:28+00:00"
         },
         {
             "name": "swiftmailer/swiftmailer",
-            "version": "v6.2.4",
+            "version": "v6.2.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/swiftmailer/swiftmailer.git",
-                "reference": "56f0ab23f54c4ccbb0d5dcc67ff8552e0c98d59e"
+                "reference": "698a6a9f54d7eb321274de3ad19863802c879fb7"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/56f0ab23f54c4ccbb0d5dcc67ff8552e0c98d59e",
-                "reference": "56f0ab23f54c4ccbb0d5dcc67ff8552e0c98d59e",
+                "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/698a6a9f54d7eb321274de3ad19863802c879fb7",
+                "reference": "698a6a9f54d7eb321274de3ad19863802c879fb7",
                 "shasum": ""
             },
             "require": {
@@ -4752,7 +4754,7 @@
             ],
             "support": {
                 "issues": "https://github.com/swiftmailer/swiftmailer/issues",
-                "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.2.4"
+                "source": "https://github.com/swiftmailer/swiftmailer/tree/v6.2.5"
             },
             "funding": [
                 {
@@ -4764,7 +4766,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2020-12-08T18:02:06+00:00"
+            "time": "2021-01-12T09:35:59+00:00"
         },
         {
             "name": "symfony/console",
@@ -9165,16 +9167,16 @@
         },
         {
             "name": "maximebf/debugbar",
-            "version": "v1.16.4",
+            "version": "v1.16.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/maximebf/php-debugbar.git",
-                "reference": "c86c717e4bf3c6d98422da5c38bfa7b0f494b04c"
+                "reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/c86c717e4bf3c6d98422da5c38bfa7b0f494b04c",
-                "reference": "c86c717e4bf3c6d98422da5c38bfa7b0f494b04c",
+                "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6d51ee9e94cff14412783785e79a4e7ef97b9d62",
+                "reference": "6d51ee9e94cff14412783785e79a4e7ef97b9d62",
                 "shasum": ""
             },
             "require": {
@@ -9224,9 +9226,9 @@
             ],
             "support": {
                 "issues": "https://github.com/maximebf/php-debugbar/issues",
-                "source": "https://github.com/maximebf/php-debugbar/tree/v1.16.4"
+                "source": "https://github.com/maximebf/php-debugbar/tree/v1.16.5"
             },
-            "time": "2020-12-07T10:48:48+00:00"
+            "time": "2020-12-07T11:07:24+00:00"
         },
         {
             "name": "mockery/mockery",
@@ -9955,16 +9957,16 @@
         },
         {
             "name": "phpseclib/phpseclib",
-            "version": "3.0.2",
+            "version": "3.0.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/phpseclib/phpseclib.git",
-                "reference": "7a9418e4e02a3da7950b6b85c30e694d68daf995"
+                "reference": "97a5a270e4a9ebfc1a7e2f462e917cbce1a8e6d9"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7a9418e4e02a3da7950b6b85c30e694d68daf995",
-                "reference": "7a9418e4e02a3da7950b6b85c30e694d68daf995",
+                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/97a5a270e4a9ebfc1a7e2f462e917cbce1a8e6d9",
+                "reference": "97a5a270e4a9ebfc1a7e2f462e917cbce1a8e6d9",
                 "shasum": ""
             },
             "require": {
@@ -10046,7 +10048,7 @@
             ],
             "support": {
                 "issues": "https://github.com/phpseclib/phpseclib/issues",
-                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.2"
+                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.3"
             },
             "funding": [
                 {
@@ -10062,7 +10064,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2020-12-23T16:39:00+00:00"
+            "time": "2021-01-16T17:35:19+00:00"
         },
         {
             "name": "phpspec/prophecy",
@@ -10451,16 +10453,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "9.5.0",
+            "version": "9.5.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe"
+                "reference": "e7bdf4085de85a825f4424eae52c99a1cec2f360"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e16c225d57c3d6808014df6b1dd7598d0a5bbbe",
-                "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e7bdf4085de85a825f4424eae52c99a1cec2f360",
+                "reference": "e7bdf4085de85a825f4424eae52c99a1cec2f360",
                 "shasum": ""
             },
             "require": {
@@ -10538,7 +10540,7 @@
             ],
             "support": {
                 "issues": "https://github.com/sebastianbergmann/phpunit/issues",
-                "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.0"
+                "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.1"
             },
             "funding": [
                 {
@@ -10550,7 +10552,7 @@
                     "type": "github"
                 }
             ],
-            "time": "2020-12-04T05:05:53+00:00"
+            "time": "2021-01-17T07:42:25+00:00"
         },
         {
             "name": "react/promise",

+ 14 - 14
resources/views/admin/config/system.blade.php

@@ -927,8 +927,8 @@
                                                 <select id="node_offline_notification" data-plugin="selectpicker" data-style="btn-outline btn-primary"
                                                         onchange="updateFromOther('select','node_offline_notification')" multiple>
                                                     <option value="mail">邮箱</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="bark">Bark</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
@@ -959,8 +959,8 @@
                                                 <select id="node_blocked_notification" data-plugin="selectpicker" data-style="btn-outline btn-primary"
                                                         onchange="updateFromOther('select','node_blocked_notification')" multiple>
                                                     <option value="mail">邮箱</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
                                                 <span class="text-help"> 每小时检测节点是否被阻断并提醒管理员 </span>
@@ -1004,8 +1004,8 @@
                                                         onchange="updateFromOther('select','ticket_closed_notification')" multiple>
                                                     <option value="mail">邮箱</option>
                                                     <option value="database">站内通知</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="bark">Bark</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
@@ -1021,8 +1021,8 @@
                                                         onchange="updateFromOther('select','ticket_created_notification')" multiple>
                                                     <option value="mail">邮箱</option>
                                                     <option value="database">站内通知</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="bark">Bark</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
@@ -1038,8 +1038,8 @@
                                                         onchange="updateFromOther('select','ticket_replied_notification')" multiple>
                                                     <option value="mail">邮箱</option>
                                                     <option value="database">站内通知</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="bark">Bark</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
@@ -1184,8 +1184,8 @@
                                                 <select id="data_anomaly_notification" data-plugin="selectpicker" data-style="btn-outline btn-primary"
                                                         onchange="updateFromOther('select','data_anomaly_notification')" multiple>
                                                     <option value="mail">邮箱</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="bark">Bark</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
@@ -1252,8 +1252,8 @@
                                                 <select id="node_daily_notification" data-plugin="selectpicker" data-style="btn-outline btn-primary"
                                                         onchange="updateFromOther('select','node_daily_notification')" multiple>
                                                     <option value="mail">邮箱</option>
-                                                    <option value="telegram">Telegram</option>
-                                                    <option value="beary">BearyChat</option>
+                                                    <option value="telegram" disabled>Telegram</option>
+                                                    <option value="beary" disabled>BearyChat</option>
                                                     <option value="serverChan">ServerChan</option>
                                                 </select>
                                             </div>

+ 5 - 4
resources/views/admin/permission/info.blade.php

@@ -20,14 +20,14 @@
                     @isset($permission)@method('PUT')@endisset
                     @csrf
                     <div class="form-group row">
-                        <label class="col-md-2 col-sm-3 col-form-label" for="description">名称</label>
+                        <label class="col-md-2 col-sm-3 col-form-label" for="description">行为描述</label>
                         <div class="col-md-7 col-sm-8">
                             <input type="text" class="form-control" name="description" id="description" required/>
-                            <span class="text-help"> 填写名称,例:【A系统】编辑A </span>
+                            <span class="text-help"> 填写描述,例:【A系统】编辑A </span>
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label class="col-md-2 col-sm-3 col-form-label" for="name">行为</label>
+                        <label class="col-md-2 col-sm-3 col-form-label" for="name">路由名称</label>
                         <div class="col-md-7 col-sm-8">
                             <input type="text" class="form-control" name="name" id="name" required/>
                             <span class="text-help"> 填写路由名称,例:admin.permission.create,update </span>
@@ -48,9 +48,10 @@
           @isset($permission)
           $('#description').val(@json(old('description') ?? $permission->description));
         $('#name').val(@json(old('name') ?? $permission->name));
-          @endisset
+          @else
           $('#description').val(@json(old('description')));
         $('#name').val(@json(old('name')));
+          @endisset
       });
     </script>
 @endsection

+ 4 - 4
resources/views/admin/rule/index.blade.php

@@ -47,10 +47,10 @@
                             <td> {{$rule->id}} </td>
                             <td> {!! $rule->type_label !!} </td>
                             <td>
-                                <input type="text" class="form-control" name="rule_name" id="rule_name_{{$rule->id}}" value="{{$rule->name}}"/>
+                                <input type="text" class="form-control" name="name" id="name_{{$rule->id}}" value="{{$rule->name}}"/>
                             </td>
                             <td>
-                                <input type="text" class="form-control" name="rule_pattern" id="rule_pattern_{{$rule->id}}" value="{{$rule->pattern}}"/>
+                                <input type="text" class="form-control" name="pattern" id="pattern_{{$rule->id}}" value="{{$rule->pattern}}"/>
                             </td>
                             <td>
                                 @canany(['admin.rule.update', 'admin.rule.destroy'])
@@ -191,8 +191,8 @@
           url: '{{route('admin.rule.update','')}}/' + id,
           data: {
             _token: '{{csrf_token()}}',
-            rule_name: $('#rule_name_' + id).val(),
-            rule_pattern: $('#rule_pattern_' + id).val(),
+            name: $('#name_' + id).val(),
+            pattern: $('#pattern_' + id).val(),
           },
           dataType: 'json',
           success: function(ret) {

+ 3 - 3
resources/views/user/invoices.blade.php

@@ -47,7 +47,7 @@
                                         @elseif($order->payment->url)
                                             <a href="{{$order->payment->url}}" target="_blank" class="btn btn-primary">{{trans('user.pay')}}</a>
                                         @endif
-                                        <button onclick="closeOrder('{{$order->id}}')" class="btn btn-danger">{{trans('common.cancel')}}</button>
+                                        <button onclick="closeOrder('{{route('closeOrder', $order)}}')" class="btn btn-danger">{{trans('common.cancel')}}</button>
                                     @elseif ($order->status === 1)
                                         <button onClick="window.location.reload();" class="btn btn-primary">
                                             <i class="icon wb-refresh" aria-hidden="true"></i></button>
@@ -102,7 +102,7 @@
         });
       }
 
-      function closeOrder(id) {
+      function closeOrder(url) {
         swal.fire({
           title: '{{trans('common.close_item', ['attribute' => trans('user.invoice.attribute')])}}?',
           icon: 'warning',
@@ -113,7 +113,7 @@
           if (result.value) {
             $.ajax({
               method: 'PUT',
-              url: '{{route('closeOrder', '')}}/' + id,
+              url: url,
               dataType: 'json',
               data: {_token: '{{csrf_token()}}'},
               success: function(ret) {