controller refactoring part 24

This commit is contained in:
Peter Papp
2021-07-21 18:14:23 +02:00
parent 91cb795054
commit 54f1f4c9a8
18 changed files with 136 additions and 138 deletions

View File

@@ -1,12 +1,9 @@
<?php
namespace App\Users\Controllers;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
class GetAvatarController
{
@@ -15,8 +12,7 @@ class GetAvatarController
*/
public function __invoke(
string $basename
): StreamedResponse|FileNotFoundException {
): StreamedResponse | FileNotFoundException {
// Check if file exist
if (! Storage::exists("/avatars/$basename")) {
abort(404);
@@ -25,4 +21,4 @@ class GetAvatarController
// Return avatar
return Storage::download("/avatars/$basename", $basename);
}
}
}