Laravel-我在请求验证器中添加时找不到路由

时间:2019-03-29 17:59:22

标签: laravel laravel-5 braintree

我具有处理我的应用程序中的付款的功能。当我将Request $request更改为PropertyPaymentRequest $request时,有什么原因吗?

public function ProcessAdvertPayment(Property $property, PropertyPaymentRequest $request)
{
    $payload = $request->input('payload', false);
    $nonce = $payload['nonce'];

    $payment = Braintree_Transaction::sale([
        'amount' => 1,
        'paymentMethodNonce' => $nonce,
        'creditCard' => [
            'number' => request('cardnumber'), 'expirationDate' => request('month').'/'.request('year'),
            "cvv" => request('cvv')
        ],
    ]);

    if ($payment->success) {
        $property->payment()->create($request);
    }

    return response()->json($payment);
}

请求的导入

use App\Http\Requests\PropertyPaymentRequest;

路线

Route::prefix('advertisement')->group(function () {
    Route::post('{property}/payment', 'API\PropertyController@ProcessAdvertPayment');
});

0 个答案:

没有答案