LoginController::redirectTo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Enomotodev\LaractiveAdmin\Http\Controllers\Auth;
4
5
use Illuminate\Http\Request;
6
use App\Http\Controllers\Controller;
7
use Illuminate\Support\Facades\Auth;
8
use Illuminate\Foundation\Auth\AuthenticatesUsers;
9
10
class LoginController extends Controller
11
{
12
    use AuthenticatesUsers;
0 ignored issues
show
introduced by
The trait Illuminate\Foundation\Auth\AuthenticatesUsers requires some properties which are not provided by Enomotodev\LaractiveAdmi...rs\Auth\LoginController: $redirectTo, $maxAttempts, $decayMinutes
Loading history...
13
14
    /**
15
     * @return void
16
     */
17 10
    public function __construct()
18
    {
19 10
    }
20
21
    /**
22
     * @return \Illuminate\Http\Response
23
     */
24 10
    public function showLoginForm()
25
    {
26 10
        return view('laractive-admin::auth.login');
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('laractive-admin::auth.login') returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
27
    }
28
29
    /**
30
     * Log the user out of the application.
31
     *
32
     * @param  \Illuminate\Http\Request  $request
33
     * @return \Illuminate\Http\Response
34
     */
35 2
    public function logout(Request $request)
36
    {
37 2
        $this->guard()->logout();
38
39 2
        $request->session()->invalidate();
40
41 2
        return redirect(route('admin.login'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return redirect(route('admin.login')) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
42
    }
43
44
    /**
45
     * @return string
46
     */
47 7
    protected function redirectTo()
48
    {
49 7
        return route('admin.dashboard.index');
50
    }
51
52
    /**
53
     * @return \Illuminate\Contracts\Auth\StatefulGuard
54
     */
55 8
    protected function guard()
56
    {
57 8
        return Auth::guard('laractive-admin');
58
    }
59
}
60