Passed
Push — dev5a ( d46f4b...f24c41 )
by Ron
07:14
created

UserRoleController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A submitRole() 0 5 1
A permissionSettings() 0 5 1
1
<?php
2
3
namespace App\Http\Controllers\Admin;
4
5
use App\Http\Controllers\Controller;
6
use App\Http\Requests\Admin\NewRoleRequest;
7
8
use Illuminate\Support\Facades\Auth;
9
use Illuminate\Support\Facades\Log;
10
11
use App\Domains\Roles\GetRoles;
12
use App\Domains\Roles\GetPermissions;
13
use App\Domains\Roles\SetPermissions;
14
15
class UserRoleController extends Controller
16
{
17 2
    public function permissionSettings()
18
    {
19 2
        return view('admin.userPermissions', [
20 2
            'roles' => (new GetRoles)->getRoleList(false),
21 2
            'perms' => (new GetPermissions)->getAllPermissions(),
22
        ]);
23
    }
24
25 2
    public function submitRole(NewRoleRequest $request)
26
    {
27 2
        (new SetPermissions)->submitRole($request);
28 2
        Log::notice('User Permissions Role '.$request->name.' has been updated by '.Auth::user()->full_name.'.  Data - ', $request->toArray());
29 2
        return response()->json(['success' => true]);
30
    }
31
}
32