controller refactoring part 25

This commit is contained in:
Peter Papp
2021-07-22 07:49:25 +02:00
parent 6d8a7a429c
commit 5167f082f7
50 changed files with 252 additions and 481 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace Domain\Settings\Controllers;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
class GetAppImageController
{
/**
* Get system image
*/
public function __invoke(
string $basename
): StreamedResponse | FileNotFoundException {
// Check if file exist
if (! Storage::exists("/system/$basename")) {
abort(404);
}
// Return avatar
return Storage::download("/system/$basename", $basename);
}
}