Config.php 557 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\models;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Support\Facades\Validator;
  5. class Config extends BaseModel
  6. {
  7. public function getValidator(Request $request, $type)
  8. {
  9. $validator = Validator::make($request->input('data'), [
  10. 'value' => 'required'
  11. ], [
  12. 'value.required' => '值必填'
  13. ]);
  14. return $validator;
  15. }
  16. public static function getTitle()
  17. {
  18. $config = Config::where('key', 'title')->first();
  19. return $config ? $config['value'] : '';
  20. }
  21. }