Completed
Push — master ( d5537d...bd4222 )
by Arjay
13:20
created

ThemeChanger::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
cc 2
eloc 6
c 2
b 1
f 1
nc 2
nop 2
dl 0
loc 10
rs 9.4285
1
<?php
2
3
namespace Yajra\CMS\Http\Middleware;
4
5
use Closure;
6
7
class ThemeChanger
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param  \Illuminate\Http\Request $request
13
     * @param  \Closure $next
14
     * @return mixed
15
     */
16
    public function handle($request, Closure $next)
17
    {
18
        if ($request->query('tmpl')) {
19
            $finder   = app('theme.view.finder');
20
            $basePath = config('theme.path', base_path('themes')) . DIRECTORY_SEPARATOR . $request->query('tmpl');
21
            $finder->setBasePath($basePath);
22
        }
23
24
        return $next($request);
25
    }
26
}
27