UsersController::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php namespace JobApis\JobsToMail\Http\Controllers;
2
3
use Illuminate\Foundation\Bus\DispatchesJobs;
4
use Illuminate\Http\Request;
5
use Illuminate\Routing\Controller as BaseController;
6
use Illuminate\Foundation\Validation\ValidatesRequests;
7
use JobApis\JobsToMail\Http\Requests\CreateUser;
8
use JobApis\JobsToMail\Jobs\Users\CreateUserAndSearch;
9
use JobApis\JobsToMail\Jobs\Users\Delete;
10
11
class UsersController extends BaseController
12
{
13
    use DispatchesJobs, ValidatesRequests;
14
15
    /**
16
     * Create new User.
17
     */
18
    public function create(CreateUser $request)
19
    {
20
        $data = $request->only(array_keys($request->rules()));
21
22
        $message = $this->dispatchNow(new CreateUserAndSearch($data));
23
24
        $request->session()->flash($message->type, $message->message);
0 ignored issues
show
Bug introduced by
The method flash() does not seem to exist on object<Symfony\Component...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
        return redirect('/');
27
    }
28
29
    /**
30
     * Delete a user account (unsubscribe from all searches)
31
     */
32
    public function delete(Request $request, $userId)
33
    {
34
        $message = $this->dispatchNow(new Delete($userId));
35
36
        $request->session()->flash($message->type, $message->message);
0 ignored issues
show
Bug introduced by
The method flash() does not seem to exist on object<Symfony\Component...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
38
        return redirect('/');
39
    }
40
}
41