Unsubscribe::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\Paypal;
4
5
use App\Http\Controllers\Controller;
6
use App\Models\PaypalSubscription as PaypalSub;
7
use Illuminate\Http\Request;
8
use leifermendez\paypal\PaypalSubscription;
9
10
class Unsubscribe extends Controller
11
{
12
    /**
13
     * Handle the incoming request.
14
     *
15
     * @return \Illuminate\Http\Response
16
     */
17
    public function __invoke(Request $request)
18
    {
19
        $pp = new PaypalSubscription();
20
        $response = $pp->cancelSubscription($request->paypal_subscription_id);
21
22
        PaypalSub::where('paypal_id', $request->paypal_subscription_id)
23
            ->update(['status' => 'CANCELLED']);
24
25
        return $response;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $response also could return the type string which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
26
    }
27
}
28