Passed
Push — develop ( df7120...10a553 )
by Francisco
02:39
created

AuthorizeExchangeActions::checkEnrollmentPeriod()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 9
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
7
class AuthorizeExchangeActions
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param \Illuminate\Http\Request $request
13
     * @param \Closure                 $next
14
     *
15
     * @return mixed
16
     */
17
    public function handle($request, Closure $next)
18
    {
19
        if (! app('settings')->withinExchangePeriod()) {
20
            flash('The exchanges period is closed. You are not allowed to perform this action.')->error();
21
22
            return redirect()->route('home');
23
        }
24
25
        return $next($request);
26
    }
27
}
28