mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-19 00:22:15 +00:00
controller refactoring part 25
This commit is contained in:
24
src/Domain/Settings/Controllers/GetAppImageController.php
Normal file
24
src/Domain/Settings/Controllers/GetAppImageController.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user