mirror of
https://github.com/the-programmers-hangout/Mimic.git
synced 2026-09-06 07:56:21 +02:00
init
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Config extends Model
|
||||
{
|
||||
protected $fillable = ['key', 'value'];
|
||||
|
||||
public static function get($key, $default = null)
|
||||
{
|
||||
$config = self::where('key', $key)->first();
|
||||
|
||||
return $config ? $config->value : $default;
|
||||
}
|
||||
|
||||
public static function set($key, $value)
|
||||
{
|
||||
return self::updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user