disk = $disk; } /** * Cast the given value. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $key * @param mixed $value * @param array $attributes * @return string */ public function get($model, $key, $value, $attributes) { return $value ? (Str::startsWith($value, ['http://', 'https://']) ? $value : Storage::disk($this->disk)->url($value)) : null; } /** * Prepare the given value for storage. * * @param \Illuminate\Database\Eloquent\Model $model * @param string $key * @param string $value * @param array $attributes * @return string */ public function set($model, $key, $value, $attributes) { return $value; } }