<?php

namespace App\models;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;

class Config extends BaseModel
{
    public function getValidator(Request $request, $type)
    {
        $validator = Validator::make($request->input('data'), [
            'value' => 'required'
        ], [
            'value.required' => '值必填'
        ]);
        return $validator;
    }

    public static function getTitle()
    {
        $config = Config::where('key', 'title')->first();
        return $config ? $config['value'] : '';
    }
}
