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

AdminController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 9
Bugs 4 Features 1
Metric Value
wmc 3
c 9
b 4
f 1
lcom 1
cbo 1
dl 0
loc 35
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A dashboard() 0 6 1
A redirect() 0 5 1
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