feat: s3
This commit is contained in:
@@ -49,7 +49,6 @@ class UserForm
|
||||
FileUpload::make('avatar_url')
|
||||
->label(__('admin.users.fields.avatar'))
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('avatars')
|
||||
->visibility('public')
|
||||
->maxSize(2048),
|
||||
|
||||
@@ -252,10 +252,10 @@ class AuthController extends Controller
|
||||
|
||||
if ($request->hasFile('avatar')) {
|
||||
if ($user->avatar_url) {
|
||||
Storage::disk('public')->delete($user->avatar_url);
|
||||
Storage::disk()->delete($user->avatar_url);
|
||||
}
|
||||
|
||||
$path = $request->file('avatar')->store('avatars', 'public');
|
||||
$path = $request->file('avatar')->store('avatars', );
|
||||
$data['avatar_url'] = $path;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ class AuthController extends Controller
|
||||
});
|
||||
|
||||
if (! empty($storagePaths)) {
|
||||
Storage::disk('public')->delete($storagePaths);
|
||||
Storage::disk()->delete($storagePaths);
|
||||
}
|
||||
|
||||
if ($request->hasSession()) {
|
||||
@@ -320,7 +320,7 @@ class AuthController extends Controller
|
||||
|
||||
$avatarPath = null;
|
||||
if ($request->hasFile('avatar')) {
|
||||
$avatarPath = $request->file('avatar')->store('avatars', 'public');
|
||||
$avatarPath = $request->file('avatar')->store('avatars');
|
||||
}
|
||||
|
||||
$userAttributes = $this->userAttributesFromRequestData($data);
|
||||
@@ -338,7 +338,7 @@ class AuthController extends Controller
|
||||
$user->forceDelete();
|
||||
|
||||
if ($avatarPath !== null) {
|
||||
Storage::disk('public')->delete($avatarPath);
|
||||
Storage::disk()->delete($avatarPath);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
|
||||
@@ -231,7 +231,7 @@ class MealPostController extends Controller
|
||||
$data = $request->validated();
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$path = $request->file('image')->store('meal-posts', 'public');
|
||||
$path = $request->file('image')->store('meal-posts', );
|
||||
$data['image_url'] = $path;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ class User extends Authenticatable implements FilamentUser, HasAvatar, HasLocale
|
||||
|
||||
public function getFilamentAvatarUrl(): ?string
|
||||
{
|
||||
return Storage::url($this->avatar_url);
|
||||
return $this->avatar_url ? Storage::url($this->avatar_url) : null;
|
||||
}
|
||||
|
||||
public function deviceTokens(): HasMany
|
||||
|
||||
@@ -116,7 +116,7 @@ class AiMealPostGenerator
|
||||
->timeout($this->imageTimeout())
|
||||
->generate();
|
||||
|
||||
$path = $response->storePublicly($this->imageStoragePath(), 'public');
|
||||
$path = $response->storePublicly($this->imageStoragePath(), );
|
||||
|
||||
if (! is_string($path)) {
|
||||
throw new RuntimeException("L'image du repas IA n'a pas pu etre stockee.");
|
||||
|
||||
Reference in New Issue
Block a user