229 url for downloads (#369)

* Allow file uploads for subfleet

* Allow URL to be used for a download

* Remove old FileUploadRequest

* Move file removal logic to service layer

* Remove unused import

* Remove unused packages
This commit is contained in:
Nabeel S
2019-08-26 14:43:50 -04:00
committed by GitHub
parent bbec276da8
commit 651174bda8
7 changed files with 112 additions and 39 deletions

View File

@@ -6,6 +6,7 @@ use App\Contracts\Model;
use App\Models\Traits\HashIdTrait;
use App\Models\Traits\ReferenceTrait;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* @property string $name
@@ -80,6 +81,10 @@ class File extends Model
*/
public function getUrlAttribute(): string
{
if (Str::startsWith($this->path, 'http')) {
return $this->path;
}
$disk = $this->disk ?? config('filesystems.public_files');
// If the disk isn't stored in public (S3 or something),