CastsAttributes.php 803 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Illuminate\Contracts\Database\Eloquent;
  3. /**
  4. * @template TGet
  5. * @template TSet
  6. */
  7. interface CastsAttributes
  8. {
  9. /**
  10. * Transform the attribute from the underlying model values.
  11. *
  12. * @param \Illuminate\Database\Eloquent\Model $model
  13. * @param string $key
  14. * @param mixed $value
  15. * @param array $attributes
  16. * @return TGet|null
  17. */
  18. public function get($model, string $key, $value, array $attributes);
  19. /**
  20. * Transform the attribute to its underlying model values.
  21. *
  22. * @param \Illuminate\Database\Eloquent\Model $model
  23. * @param string $key
  24. * @param TSet|null $value
  25. * @param array $attributes
  26. * @return mixed
  27. */
  28. public function set($model, string $key, $value, array $attributes);
  29. }