AdminController::dashboard()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backpack\Base\app\Http\Controllers;
4
5
class AdminController extends Controller
6
{
7
    protected $data = []; // the information we send to the view
8
9
    /**
10
     * Create a new controller instance.
11
     */
12
    public function __construct()
13
    {
14
        $this->middleware(backpack_middleware());
15
    }
16
17
    /**
18
     * Show the admin dashboard.
19
     *
20
     * @return \Illuminate\Http\Response
21
     */
22
    public function dashboard()
23
    {
24
        $this->data['title'] = trans('backpack::base.dashboard'); // set the page title
25
26
        return view('backpack::dashboard', $this->data);
27
    }
28
29
    /**
30
     * Redirect to the dashboard.
31
     *
32
     * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
33
     */
34
    public function redirect()
35
    {
36
        // The '/admin' route is not to be used as a page, because it breaks the menu's active state.
37
        return redirect(backpack_url('dashboard'));
0 ignored issues
show
Bug introduced by
It seems like backpack_url('dashboard') targeting backpack_url() can also be of type object<Illuminate\Contracts\Routing\UrlGenerator>; however, redirect() does only seem to accept string|null, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
38
    }
39
}
40