Completed
Push — master ( ccd735...675cf9 )
by Arthur
07:53
created

Settings::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php namespace BB\Entities;
2
3
use Carbon\Carbon;
4
use Illuminate\Database\Eloquent\Model;
5
6
/**
7
 * Class Activity
8
 *
9
 * @property integer $id
10
 * @property integer $key_fob_id
11
 * @property integer $user_id
12
 * @property User    $user
13
 * @property string  $service
14
 * @property string  $response
15
 * @property bool    $delayed
16
 * @property Carbon  $created_at
17
 * @package BB\Entities
18
 */
19
class Settings extends Model
20
{
21
22
    /**
23
     * The database table used by the model.
24
     *
25
     * @var string
26
     */
27
    protected $table = 'settings';
28
29
    protected $primaryKey = 'key';
30
31
    public $incrementing = false;
32
33
    public $timestamps = false;
34
35
    protected $fillable = ['key', 'value'];
36
37
    public static function put($key, $value)
38
    {
39
        self::create(['key' => $key, 'value' => $value]);
40
    }
41
42
    public static function get($key)
43
    {
44
        $setting = self::findOrFail($key);
45
        return $setting->value;
46
    }
47
48
49
}
50