SmartCane/laravel_app/app/Livewire/Project/ReportRow.php
Martin Folkerts eb1def36a1 wip
2023-12-22 16:55:40 +01:00

25 lines
465 B
PHP

<?php
namespace App\Livewire\Project;
use App\Models\ProjectReport;
use Illuminate\Support\Facades\Storage;
use Livewire\Component;
class ReportRow extends Component
{
public ProjectReport $report;
public function download()
{
$filePath = $this->report->project->download_path . '/' . $this->report->path;
if (!Storage::exists($filePath)) {
abort(404);
}
return Storage::download($filePath);
}
}