1 | <?php |
||
2 | |||
3 | namespace crocodicstudio\crudbooster\middlewares; |
||
4 | |||
5 | use Closure; |
||
6 | use CRUDBooster; |
||
0 ignored issues
–
show
|
|||
7 | use DB; |
||
8 | |||
9 | class CBBackend |
||
10 | { |
||
11 | /** |
||
12 | * Handle an incoming request. |
||
13 | * |
||
14 | * @param \Illuminate\Http\Request $request |
||
15 | * @param \Closure $next |
||
16 | * @return mixed |
||
17 | */ |
||
18 | public function handle($request, Closure $next) |
||
19 | { |
||
20 | $admin_path = config('crudbooster.ADMIN_PATH') ?: 'admin'; |
||
21 | |||
22 | if (CRUDBooster::myId() == '') { |
||
23 | $url = url($admin_path.'/login'); |
||
24 | |||
25 | return redirect($url)->with('message', trans('crudbooster.not_logged_in')); |
||
26 | } |
||
27 | if (CRUDBooster::isLocked()) { |
||
28 | $url = url($admin_path.'/lock-screen'); |
||
29 | |||
30 | return redirect($url); |
||
31 | } |
||
32 | if($request->url()==CRUDBooster::adminPath('')){ |
||
33 | $menus=DB::table('cms_menus')->whereRaw("cms_menus.id IN (select id_cms_menus from cms_menus_privileges where id_cms_privileges = '".CRUDBooster::myPrivilegeId()."')")->where('is_dashboard', 1)->where('is_active', 1)->first(); |
||
34 | if ($menus) { |
||
35 | if ($menus->type == 'Statistic') { |
||
36 | return redirect()->action('\crocodicstudio\crudbooster\controllers\StatisticBuilderController@getDashboard'); |
||
37 | } elseif ($menus->type == 'Module') { |
||
38 | $module = CRUDBooster::first('cms_moduls', ['path' => $menus->path]); |
||
39 | return redirect()->action( $module->controller.'@getIndex'); |
||
40 | } elseif ($menus->type == 'Route') { |
||
41 | $action = str_replace("Controller", "Controller@", $menus->path); |
||
42 | $action = str_replace(['Get', 'Post'], ['get', 'post'], $action); |
||
43 | return redirect()->action($action); |
||
44 | } elseif ($menus->type == 'Controller & Method') { |
||
45 | return redirect()->action($menus->path); |
||
46 | } elseif ($menus->type == 'URL') { |
||
47 | return redirect($menus->path); |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 | return $next($request); |
||
52 | } |
||
53 | } |
||
54 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths