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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user