AbstractField.php 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Dcat\Admin\Show;
  3. use Illuminate\Contracts\Support\Renderable;
  4. use Illuminate\Support\Fluent;
  5. abstract class AbstractField implements Renderable
  6. {
  7. /**
  8. * Field value.
  9. *
  10. * @var mixed
  11. */
  12. protected $value;
  13. /**
  14. * Current field model.
  15. *
  16. * @var Fluent
  17. */
  18. protected $model;
  19. /**
  20. * If this field show with a border.
  21. *
  22. * @var bool
  23. */
  24. public $border = true;
  25. /**
  26. * If this field show escaped contents.
  27. *
  28. * @var bool
  29. */
  30. public $escape = false;
  31. /**
  32. * @param mixed $value
  33. * @return AbstractField $this
  34. */
  35. public function setValue($value)
  36. {
  37. $this->value = $value;
  38. return $this;
  39. }
  40. /**
  41. * @param Fluent $model
  42. * @return AbstractField $this
  43. */
  44. public function setModel($model)
  45. {
  46. $this->model = $model;
  47. return $this;
  48. }
  49. /**
  50. * @return mixed
  51. */
  52. abstract public function render();
  53. }