diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index 276b3a0..5619a86 100644
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -179,13 +179,11 @@ class UsersController extends Controller
'photo' => 'required|image|max:200',
]);
- $storage = env('APP_ENV') == 'testing' ? 'avatars' : 'public';
-
- if (Storage::disk($storage)->exists($user->photo_path)) {
- Storage::disk($storage)->delete($user->photo_path);
+ if (Storage::exists($user->photo_path)) {
+ Storage::delete($user->photo_path);
}
- $user->photo_path = $request->photo->store('images', $storage);
+ $user->photo_path = $request->photo->store('images');
$user->save();
return back();
diff --git a/phpunit.xml b/phpunit.xml
index f5f6354..bec66c3 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -29,5 +29,6 @@
+
diff --git a/tests/Feature/UsersProfileTest.php b/tests/Feature/UsersProfileTest.php
index d92cdb9..2bdbf9b 100644
--- a/tests/Feature/UsersProfileTest.php
+++ b/tests/Feature/UsersProfileTest.php
@@ -96,7 +96,7 @@ class UsersProfileTest extends TestCase
/** @test */
public function user_can_upload_their_own_photo()
{
- Storage::fake('avatars');
+ Storage::fake(config('filesystems.default'));
$user = $this->loginAsUser();
$this->visit(route('users.edit', $user->id));
@@ -110,7 +110,7 @@ class UsersProfileTest extends TestCase
$user = $user->fresh();
$this->assertNotNull($user->photo_path);
- Storage::disk('avatars')->assertExists($user->photo_path);
+ Storage::assertExists($user->photo_path);
}
/** @test */