Completed
Push — master ( 9ef2b9...d02efc )
by wen
03:42
created

RoleController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 27
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getList() 0 5 1
A getAll() 0 5 1
A delete() 0 8 2
A authorize() 0 3 1
1
<?php
2
3
4
namespace Sco\Admin\Http\Controllers\Manager;
5
6
use Sco\Admin\Exceptions\AdminHttpException;
7
use Sco\Admin\Http\Controllers\BaseController;
8
use Sco\Admin\Models\Role;
9
10
class RoleController extends BaseController
11
{
12
    public function getList()
13
    {
14
        $roles = Role::paginate();
15
        return response()->json($roles);
16
    }
17
18
    public function getAll()
19
    {
20
        $roles = Role::all();
21
        return response()->json($roles);
22
    }
23
24
    public function delete($id)
25
    {
26
        if ($id == 1) {
27
            throw new AdminHttpException('超级管理员角色不能删除');
28
29
        }
30
31
    }
32
33
    public function authorize()
34
    {
35
    }
36
}
37