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