HttpToHttps.php 423 B

1234567891011121314151617
  1. <?php
  2. namespace App\Casts;
  3. use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
  4. class HttpToHttps implements CastsAttributes
  5. {
  6. public function get($model, string $key, $value, array $attributes)
  7. {
  8. return str_replace('http://','https://',$value);
  9. }
  10. public function set($model, string $key, $value, array $attributes)
  11. {
  12. return str_replace('http://','https://',$value);
  13. }
  14. }