This commit is contained in:
2025-10-27 18:02:45 +05:00
parent a96f4fc8c8
commit 918663c758
5 changed files with 26 additions and 14 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Middleware; namespace App\Http\Middleware;
use Closure; use Closure;
use Filament\Notifications\Notification;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage; use Joaopaulolndev\FilamentEditProfile\Pages\EditProfilePage;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
@@ -26,7 +27,7 @@ class EnsureProfileIsFilled
} }
// 3. Define the 'safe' routes // 3. Define the 'safe' routes
$profilePageClass = EditProfilePage::class; // <-- !! IMPORTANT: Change to your page $profilePageClass = EditProfilePage::class;
$profilePageUrl = $profilePageClass::getUrl(); $profilePageUrl = $profilePageClass::getUrl();
/** @var \Filament\Panel */ /** @var \Filament\Panel */
@@ -53,6 +54,12 @@ class EnsureProfileIsFilled
return $next($request); return $next($request);
} }
Notification::make()
->danger()
->title(__('Please update your profile'))
->color('danger')
->send();
// 6. If not, redirect them to the profile page. // 6. If not, redirect them to the profile page.
// Filament's SPA mode will intercept this 302 redirect // Filament's SPA mode will intercept this 302 redirect
// and navigate without a full page reload. // and navigate without a full page reload.

View File

@@ -18,7 +18,7 @@ use Illuminate\Contracts\View\View;
use Joaopaulolndev\FilamentEditProfile\Concerns\HasSort; use Joaopaulolndev\FilamentEditProfile\Concerns\HasSort;
use Livewire\Component; use Livewire\Component;
class UserPassportFields extends Component implements HasForms class UserProfileFields extends Component implements HasForms
{ {
use HasSort; use HasSort;
use InteractsWithForms; use InteractsWithForms;
@@ -180,15 +180,13 @@ class UserPassportFields extends Component implements HasForms
'must_fill_profile' => false, 'must_fill_profile' => false,
]); ]);
$this->dispatch('refresh-topbar'); Notification::make()
->success()
->title(__('Profile updated'))
->send();
} catch (Halt $exception) { } catch (Halt $exception) {
return; return;
} }
Notification::make()
->success()
->title(__('Profile updated'))
->send();
} }
public function render(): View public function render(): View

View File

@@ -3,6 +3,9 @@
namespace App\Providers; namespace App\Providers;
use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs; use AbdulmajeedJamaan\FilamentTranslatableTabs\TranslatableTabs;
use Filament\Notifications\Livewire\Notifications;
use Filament\Support\Enums\Alignment;
use Filament\Support\Enums\VerticalAlignment;
use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Foundation\Application;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@@ -25,6 +28,9 @@ class AppServiceProvider extends ServiceProvider
Model::unguard(); Model::unguard();
Model::shouldBeStrict(! app()->isProduction()); Model::shouldBeStrict(! app()->isProduction());
Notifications::alignment(Alignment::Center);
Notifications::verticalAlignment(VerticalAlignment::Center);
TranslatableTabs::configureUsing(function (TranslatableTabs $component) { TranslatableTabs::configureUsing(function (TranslatableTabs $component) {
$component $component
->localesLabels(baseLocales()) ->localesLabels(baseLocales())

View File

@@ -3,7 +3,7 @@
namespace App\Providers\Filament; namespace App\Providers\Filament;
use App\Http\Middleware\EnsureProfileIsFilled; use App\Http\Middleware\EnsureProfileIsFilled;
use App\Livewire\UserPassportFields; use App\Livewire\UserProfileFields;
use App\Modules\BaseAuth\Middleware\RedirectIfUserPhoneIsUnVerfied; use App\Modules\BaseAuth\Middleware\RedirectIfUserPhoneIsUnVerfied;
use BezhanSalleh\FilamentShield\FilamentShieldPlugin; use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
use CraftForge\FilamentLanguageSwitcher\FilamentLanguageSwitcherPlugin; use CraftForge\FilamentLanguageSwitcher\FilamentLanguageSwitcherPlugin;
@@ -77,7 +77,7 @@ class WorkPanelProvider extends PanelProvider
->setIcon('heroicon-o-user-circle') ->setIcon('heroicon-o-user-circle')
->shouldShowEditProfileForm(false) ->shouldShowEditProfileForm(false)
->customProfileComponents([ ->customProfileComponents([
UserPassportFields::class, UserProfileFields::class,
]), ]),
]) ])
->authMiddleware([ ->authMiddleware([
@@ -85,9 +85,9 @@ class WorkPanelProvider extends PanelProvider
EnsureProfileIsFilled::class, EnsureProfileIsFilled::class,
]) ])
->spa() ->spa()
->spaUrlExceptions(fn (): array => [ // ->spaUrlExceptions(fn (): array => [
EditProfilePage::getUrl(), // EditProfilePage::getUrl(),
]) // ])
->databaseTransactions() ->databaseTransactions()
->breadcrumbs(false) ->breadcrumbs(false)
->colors([ ->colors([

View File

@@ -667,5 +667,6 @@
"Card year": "Kart ýyl", "Card year": "Kart ýyl",
"Cards": "Kartlar", "Cards": "Kartlar",
"Loans": "Karzlar", "Loans": "Karzlar",
"Loan": "Karz" "Loan": "Karz",
"Please update your profile": "Profiliňizi doldurmagyňyzy haýyş edýäris"
} }