GraphQLSchema::register()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 7
c 2
b 1
f 0
dl 0
loc 12
rs 10
cc 2
nc 2
nop 4
1
<?php
2
3
namespace DeInternetJongens\LighthouseUtils\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class GraphQLSchema extends Model
8
{
9
    protected $table = 'graphql_schema';
10
11
    protected $guarded = ['id'];
12
13
    public static function register($action, $model, $type, $permission = null)
14
    {
15
        if (config('lighthouse-utils.authorization')) {
16
            return static::create([
17
                'name' => $action,
18
                'type' => $type,
19
                'model' => $model,
20
                'permission' => $permission,
21
            ]);
22
        }
23
24
        return null;
25
    }
26
}
27