Passed
Push — feature/experience-skills-api ( 61a84a...f678ab )
by Tristan
07:17 queued 03:18
created

Authenticate::redirectTo()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 3
nc 3
nop 1
1
<?php
2
namespace App\Http\Middleware;
3
4
use Illuminate\Auth\Middleware\Authenticate as Middleware;
5
use Facades\App\Services\WhichPortal;
6
7
class Authenticate extends Middleware
8
{
9
    /**
10
     * Get the path the user should be redirected to when they are not authenticated.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @return string
14
     */
15
    protected function redirectTo($request)
16
    {
17
        if (WhichPortal::isManagerPortal()) {
18
            return route('manager.login');
0 ignored issues
show
Bug introduced by
The function route was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
            return /** @scrutinizer ignore-call */ route('manager.login');
Loading history...
19
        } elseif (WhichPortal::isHrPortal()) {
20
            return route('hr_advisor.login');
21
        } else {
22
            return route('login');
23
        }
24
    }
25
}
26