AuthController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 14
c 1
b 0
f 1
dl 0
loc 56
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLogin() 0 3 1
A getLogout() 0 5 1
A postLogin() 0 16 2
1
<?php namespace App\Http\Controllers\Backend;
2
3
use App\Http\Controllers\Controller;
4
use Illuminate\Http\Request;
5
6
class AuthController extends Controller
7
{
8
9
    /**
10
     * The Guard implementation.
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Backend\Guard was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
     *
12
     * @var Guard
13
     */
14
    protected $auth;
15
16
    protected $guard = 'hideyobackend';
17
18
    /**
19
     * Show the application login form.
20
     *
21
     * @return \Illuminate\Http\Response
22
     */
23
    public function getLogin()
24
    {
25
        return view('backend.auth.login');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('backend.auth.login') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
26
    }
27
    
28
    /**
29
     * Log the user out of the application.
30
     *
31
     * @return \Illuminate\Http\Response
32
     */
33
    public function getLogout()
34
    {
35
        auth('hideyobackend')->logout();
36
37
        return redirect()->intended('/admin');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect()->intended('/admin') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
38
    }
39
40
    /**
41
     * Handle a login request to the application.
42
     *
43
     * @param  \Illuminate\Http\Request  $request
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function postLogin(Request $request)
47
    {
48
        $this->validate($request, [
49
            'email' => 'required|email', 'password' => 'required',
50
        ]);
51
52
        $credentials = $request->only('email', 'password');
53
54
        if (auth('hideyobackend')->attempt($credentials)) {
55
            return redirect()->intended('/admin');
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect()->intended('/admin') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
56
        }
57
58
        flash('inlog is incorrect');
59
     
60
        return redirect('/admin/security/login')
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect('/admin/...y('email', 'remember')) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
61
                    ->withInput($request->only('email', 'remember'));
62
    }
63
}
64