Unsubscribe   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 1
1
<?php
2
3
namespace App\Http\Controllers\Stripe;
4
5
use App\Http\Controllers\Controller;
6
use App\Notifications\UnsubscribeSuccessfully;
7
use Illuminate\Http\Request;
8
9
class Unsubscribe extends Controller
10
{
11
    /**
12
     * Handle the incoming request.
13
     *
14
     * @return \Illuminate\Http\Response
15
     */
16
    public function __invoke(Request $request)
17
    {
18
        $user = auth()->user();
19
20
        $user->subscription('default')->cancelNow();
21
22
        // $user->role_id = 3; //expired role
23
        //$user->save();
24
        $user->notify(new UnsubscribeSuccessfully($user->subscription()->stripe_price));
25
26
        return ['success' => true];
0 ignored issues
show
Bug Best Practice introduced by
The expression return array('success' => true) returns the type array<string,true> which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
27
    }
28
}
29