diff --git a/composer.json b/composer.json index eaad7bf6..de021687 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,6 @@ "paragonie/constant_time_encoding": "^2.7" }, "require-dev": { - "laravel/breeze": "^2.0", "laravel/jetstream": "^5.0", "laravel/sanctum": "^4.0", "livewire/livewire": "^3.3.5", diff --git a/src/HasProfilePhoto.php b/src/HasProfilePhoto.php deleted file mode 100644 index 8fcc88d3..00000000 --- a/src/HasProfilePhoto.php +++ /dev/null @@ -1,89 +0,0 @@ -profile_photo_path, function ($previous) use ($photo, $storagePath) { - $this->forceFill([ - 'profile_photo_path' => $photo->storePublicly( - $storagePath, ['disk' => $this->profilePhotoDisk()] - ), - ])->save(); - - if ($previous) { - Storage::disk($this->profilePhotoDisk())->delete($previous); - } - }); - } - - /** - * Delete the user's profile photo. - * - * @return void - */ - public function deleteProfilePhoto() - { - if (! Features::managesProfilePhotos()) { - return; - } - - if (is_null($this->profile_photo_path)) { - return; - } - - Storage::disk($this->profilePhotoDisk())->delete($this->profile_photo_path); - - $this->forceFill([ - 'profile_photo_path' => null, - ])->save(); - } - - /** - * Get the URL to the user's profile photo. - */ - public function profilePhotoUrl(): Attribute - { - return Attribute::get(function () { - return $this->profile_photo_path - ? Storage::disk($this->profilePhotoDisk())->url($this->profile_photo_path) - : $this->defaultProfilePhotoUrl(); - }); - } - - /** - * Get the default profile photo URL if no profile photo has been uploaded. - * - * @return string - */ - protected function defaultProfilePhotoUrl() - { - $name = trim(collect(explode(' ', $this->name))->map(function ($segment) { - return mb_substr($segment, 0, 1); - })->join(' ')); - - return 'https://ui-avatars.com/api/?name='.urlencode($name).'&color=7F9CF5&background=EBF4FF'; - } - - /** - * Get the disk that profile photos should be stored on. - * - * @return string - */ - protected function profilePhotoDisk() - { - return isset($_ENV['VAPOR_ARTIFACT_NAME']) ? 's3' : config('jetstream.profile_photo_disk', 'public'); - } -} diff --git a/stubs/jetstream/app/Models/User.php b/stubs/jetstream/app/Models/User.php index ef4c8825..2b475cce 100644 --- a/stubs/jetstream/app/Models/User.php +++ b/stubs/jetstream/app/Models/User.php @@ -71,7 +71,7 @@ protected function casts(): array /** * Get the URL to the user's profile photo. */ - public function profilePhotoUrl(): Attribute + protected function profilePhotoUrl(): Attribute { return filter_var($this->profile_photo_path, FILTER_VALIDATE_URL) ? Attribute::get(fn () => $this->profile_photo_path) diff --git a/stubs/jetstream/app/Models/UserWithTeams.php b/stubs/jetstream/app/Models/UserWithTeams.php index 27be9534..760bf8c5 100644 --- a/stubs/jetstream/app/Models/UserWithTeams.php +++ b/stubs/jetstream/app/Models/UserWithTeams.php @@ -70,7 +70,7 @@ class User extends Authenticatable /** * Get the URL to the user's profile photo. */ - public function profilePhotoUrl(): Attribute + protected function profilePhotoUrl(): Attribute { return filter_var($this->profile_photo_path, FILTER_VALIDATE_URL) ? Attribute::get(fn () => $this->profile_photo_path) diff --git a/tests/Feature/RouteCachingTest.php b/tests/Feature/RouteCachingTest.php index a65e214b..d806cd99 100644 --- a/tests/Feature/RouteCachingTest.php +++ b/tests/Feature/RouteCachingTest.php @@ -6,7 +6,9 @@ use Illuminate\Contracts\Console\Kernel; use Illuminate\Filesystem\Filesystem; use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Session; +use Laravel\Fortify\Features; use Laravel\Socialite\Facades\Socialite; use Laravel\Socialite\Two\GithubProvider; use Laravel\Socialite\Two\User as SocialiteUser; @@ -19,6 +21,12 @@ uses(RefreshDatabase::class); beforeEach(function () { + if (Features::enabled(Features::resetPasswords())) { + $features = array_flip($this->app['config']->get('fortify.features')); + unset($features[Features::resetPasswords()]); + $this->app['config']->set('fortify.features', array_flip($features)); + } + $files = (new Filesystem()); $files->cleanDirectory($this->app->basePath('routes')); if($files->exists($this->app->bootstrapPath(join_paths('cache', 'routes-v7.php')))) { diff --git a/tests/OrchestraTestCase.php b/tests/OrchestraTestCase.php index 425963f5..0904a571 100644 --- a/tests/OrchestraTestCase.php +++ b/tests/OrchestraTestCase.php @@ -16,6 +16,7 @@ protected function defineEnvironment($app): void { $app['config']->set('app.debug', true); $app['config']->set('database.default', 'testing'); + $app['config']->set('cache.default', 'file'); $app['config']->set('services.github', [ 'client_id' => 'github-client-id',