Destroy::__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 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\Users;
4
5
use App\Models\User;
6
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
7
use Illuminate\Http\Request;
8
use Illuminate\Routing\Controller;
9
10
class Destroy extends Controller
11
{
12
    use AuthorizesRequests;
13
14
    public function __invoke(Request $request, User $user)
15
    {
16
        $this->authorize('handle', $user);
17
18
        $user->erase($request->boolean('person'));
19
20
        return [
21
            'message' => __('The user was successfully deleted'),
22
            'redirect' => 'administration.users.index',
23
        ];
24
    }
25
}
26