Files
newznab-tmux/app/Models/Tmux.php
T
2017-07-28 10:13:25 +02:00

52 lines
821 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Tmux extends Model
{
/**
* @var string
*/
protected $table = 'tmux';
/**
* @var bool
*/
protected $dateFormat = false;
/**
* @var string
*/
public $timestamps = 'false';
/**
* @var array
*/
protected $fillable = ['setting', 'value'];
/**
* @param string $setting
*
* @param bool $returnAlways
*
* @return mixed
* @throws \RuntimeException
*/
public static function value($setting, $returnAlways = false)
{
$result = Tmux::query()->where('setting', $setting)->value('value');
if ($result !== null) {
$value = $result;
} else if ($returnAlways === false) {
throw new \RuntimeException('Unable to fetch setting from Tmux table!');
} else {
$value = null;
}
return $value;
}
}