HttpToHttps.php 528 B

12345678910111213141516171819
  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. $value = str_replace('http://','https://',$value);
  9. return str_replace('-internal','',$value);
  10. }
  11. public function set($model, string $key, $value, array $attributes)
  12. {
  13. $value = str_replace('http://','https://',$value);
  14. return str_replace('-internal','',$value);
  15. }
  16. }