Ip.php 602 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Dcat\Admin\Form\Field;
  3. class Ip extends Text
  4. {
  5. public static $js = '@jquery.inputmask';
  6. public static $css = '@jquery.inputmask';
  7. protected $rules = ['nullable', 'ip'];
  8. /**
  9. * @see https://github.com/RobinHerbots/Inputmask#options
  10. *
  11. * @var array
  12. */
  13. protected $options = [
  14. 'alias' => 'ip',
  15. ];
  16. public function render()
  17. {
  18. $this->inputmask($this->options);
  19. $this->prepend('<i class="fa fa-laptop fa-fw"></i>')
  20. ->defaultAttribute('style', 'width: 200px');
  21. return parent::render();
  22. }
  23. }