Unsubscribe::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 11
rs 10
c 0
b 0
f 0
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