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

UserRoleController::permissionSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
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