WebhookController::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace SanderVanHooft\PayableRedirect\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Illuminate\Routing\Controller;
7
use SanderVanHooft\PayableRedirect\Payment;
8
9
class WebhookController extends Controller
10
{
11
12
    public function handle(Request $request)
13
    {
14
        $payment = Payment::where('gateway_payment_reference', $request->id)->firstOrFail();
15
        $paymentGateway = new $payment->gateway_name;
16
        $paymentGateway->fetchUpdateFor($payment);
17
        return response()->json(null, 200);
18
    }
19
}
20