update: add payment save request validate

This commit is contained in:
tokumeikoi 2021-10-18 17:10:40 +08:00
parent 90211c1018
commit 37a6f3861c
2 changed files with 33 additions and 1 deletions

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Requests\Admin\PaymentSave;
use App\Services\PaymentService;
use App\Utils\Helper;
use Illuminate\Http\Request;
@ -40,7 +41,7 @@ class PaymentController extends Controller
]);
}
public function save(Request $request)
public function save(PaymentSave $request)
{
if (!config('v2board.app_url')) {
abort(500, '请在站点配置中配置站点地址');

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Foundation\Http\FormRequest;
class PaymentSave extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'payment' => 'required',
'config' => 'required'
];
}
public function messages()
{
return [
'name.required' => '显示名称不能为空',
'payment.required' => '网关参数不能为空',
'config.required' => '配置参数不能为空'
];
}
}