data->enclosure) && isset($this->data->enclosure->attributes()->url)) { // get mimes $mimes = new MimeTypes(); $extension = $mimes->getExtension($this->data->enclosure->attributes()->type); // if extension valid if ($extension) { $filename = Str::slug($this->data->title).'.'.$extension; Storage::download($this->data->enclosure->attributes()->url)->put($filename); } else { // @TODO what you do } } } }