<?php

namespace Sartoric\ModularCms\Models;

class Setting extends McmsModel
{
//    public static function settings()
//    {
//        return  null;
//    }

    public $timestamps = false;

    protected $table = 'sys_settings';

    public static function appsettings()
    {
        return Setting::where('user_id', 0)
//                        ->where('active', true)
            ->get();
    }

    public static function appSetting($setId)
    {
        $appsetting = Setting::where('user_id', 0)
            ->where('setting', $setId)
            ->first();

        if (empty($appsetting)) {
            $appsetting = config('app.'.$setId);

            return $appsetting;
        } else {
            return $appsetting->value;
        }
    }

}
