Passed
Push — master ( 51edae...d29a9b )
by Curtis
11:52 queued 05:54
created

PermissionForm   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 3 1
A edit() 0 3 1
1
<?php
2
3
namespace App\Forms\Builders\enso\Permissions;
4
5
use LaravelEnso\Forms\Services\Form;
6
use App\Models\enso\Permissions\Permission;
7
use App\Models\enso\Roles\Role;
8
9
class PermissionForm
10
{
11
    protected const FormPath = __DIR__.'/../../../Templates/enso/permissions/permission.json';
12
13
    protected Form $form;
14
15
    public function __construct()
16
    {
17
        $this->form = (new Form(static::FormPath))
18
            ->options('roles', Role::get(['name', 'id']));
19
    }
20
21
    public function create()
22
    {
23
        return $this->form->create();
24
    }
25
26
    public function edit(Permission $permission)
27
    {
28
        return $this->form->edit($permission);
29
    }
30
}
31