<?php
namespace App\Casts;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;

class HttpToHttps  implements CastsAttributes
{
    public function get($model, string $key, $value, array $attributes)
    {
        // 使用内网上传需要转换
        $value = str_replace('http://','https://',$value);
        $value = str_replace('-internal','',$value);
        return  $value;
    }


    public function set($model, string $key, $value, array $attributes)
    {
        // 使用内网上传需要转换
        $value = str_replace('http://','https://',$value);
        $value = str_replace('-internal','',$value);
        return $value;
    }
}
