Configuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 25
rs 10
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A key() 0 6 1
1
<?php
2
3
namespace Yajra\CMS\Entities;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class Configuration
9
 *
10
 * @property string key
11
 * @property string value
12
 */
13
class Configuration extends Model
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $table = 'configurations';
19
20
    /**
21
     * @var array
22
     */
23
    protected $fillable = ['key', 'value'];
24
25
    /**
26
     * Get value by key.
27
     *
28
     * @param string $key
29
     * @return string
30
     */
31
    public static function key($key)
32
    {
33
        $config = static::where('key', $key)->first();
34
35
        return $config->value ?? config($key, null);
36
    }
37
}
38