海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.0 KiB

4 years ago
  1. <?php
  2. namespace App\Admin\Forms;
  3. use App\Traits\WithdrawalTraits;
  4. use Dcat\Admin\Widgets\Form;
  5. class ServicePersonsSetting extends Form
  6. {
  7. /**
  8. * Handle the form request.
  9. *
  10. * @param array $input
  11. *
  12. * @return mixed
  13. */
  14. public function handle(array $input)
  15. {
  16. $system = \App\Models\SystemSetting::query()->firstOrCreate([
  17. 'key' => 'single'
  18. ]);
  19. $arr = [
  20. 'price' => $input['price'],
  21. ];
  22. $system->value = $arr;
  23. $system->save();
  24. return $this
  25. ->response()
  26. ->success('设置成功')
  27. ->refresh();
  28. }
  29. /**
  30. * Build a form here.
  31. */
  32. public function form()
  33. {
  34. $this->decimal('price','单人头交易费')->rules('required|numeric|min:0|not_in:0',[
  35. '*' => '金额为必填字段且必须大于0',
  36. ]);
  37. }
  38. /**
  39. * The data of the form.
  40. *
  41. * @return array
  42. */
  43. public function default()
  44. {
  45. $system = \App\Models\SystemSetting::query()->where('key','single')->value('value');
  46. return [
  47. 'price' => $system['price'] ?? 0,
  48. ];
  49. }
  50. }