feat: .jpg

This commit is contained in:
Leon 2025-12-19 15:37:16 +01:00
parent f2f91934b5
commit de8ce8941a
3 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,9 @@ public function register(RegisterRequest $request): JsonResponse
$avatarUri = null; $avatarUri = null;
if ($request->hasFile('avatar')) { if ($request->hasFile('avatar')) {
$avatarUri = $request->file('avatar')->store('avatars', 'public'); $filename = \Illuminate\Support\Str::uuid() . '.jpg';
$path = $request->file('avatar')->storeAs('avatars', $filename, 'public');
$avatarUri = url('storage/' . $path);
} }
$user = User::create([ $user = User::create([

View File

@ -22,7 +22,8 @@ class UsersController extends Controller
'avatar' => ['required', 'image', 'max:2048'], // 2MB max 'avatar' => ['required', 'image', 'max:2048'], // 2MB max
]); ]);
$path = $request->file('avatar')->store('avatars', 'public'); $filename = \Illuminate\Support\Str::uuid() . '.jpg';
$path = $request->file('avatar')->storeAs('avatars', $filename, 'public');
$user->update([ $user->update([
'avatarUri' => url('storage/' . $path), 'avatarUri' => url('storage/' . $path),

View File

@ -62,6 +62,9 @@ services:
sleep 5; sleep 5;
done; done;
echo '✅ Migrations applied.'; echo '✅ Migrations applied.';
echo '🔗 Creating storage symlink...';
php artisan storage:link || true;
echo '✅ Storage link done.';
" "
phpmyadmin: phpmyadmin: