2015-05-08 20:37:07 +02:00
|
|
|
<?php namespace Flarum;
|
|
|
|
|
2015-05-19 10:59:57 +09:30
|
|
|
use DB;
|
|
|
|
|
2015-05-08 20:37:07 +02:00
|
|
|
class Core
|
|
|
|
{
|
|
|
|
public static function isInstalled()
|
|
|
|
{
|
|
|
|
return file_exists(base_path('../config.php'));
|
|
|
|
}
|
2015-05-19 10:59:57 +09:30
|
|
|
|
|
|
|
public static function config($key, $default = null)
|
|
|
|
{
|
2015-05-27 16:25:44 +09:30
|
|
|
if (! static::isInstalled()) {
|
|
|
|
return $default;
|
|
|
|
}
|
|
|
|
|
2015-06-08 11:21:42 +02:00
|
|
|
if (is_null($value = app('db')->table('config')->where('key', $key)->pluck('value'))) {
|
2015-05-19 10:59:57 +09:30
|
|
|
$value = $default;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $value;
|
|
|
|
}
|
2015-05-08 20:37:07 +02:00
|
|
|
}
|