PlainInput.php 687 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Dcat\Admin\Form\Field;
  3. trait PlainInput
  4. {
  5. protected $prepend;
  6. protected $append;
  7. public function prepend($string)
  8. {
  9. $this->prepend = $string;
  10. return $this;
  11. }
  12. public function append($string)
  13. {
  14. $this->append = $string;
  15. return $this;
  16. }
  17. protected function initPlainInput()
  18. {
  19. if (empty($this->view)) {
  20. $this->view = 'admin::form.input';
  21. }
  22. }
  23. protected function defaultAttribute($attribute, $value)
  24. {
  25. if (! array_key_exists($attribute, $this->attributes)) {
  26. $this->attribute($attribute, $value);
  27. }
  28. return $this;
  29. }
  30. }