Completed
Pull Request — master (#33)
by
unknown
02:18
created

AdminController::dashboard()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 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('admin');
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(config('backpack.base.route_prefix').'/dashboard');
38
    }
39
}
40