Add HR resource labels and helper methods for various resources; update locale handling in user model and department factory

This commit is contained in:
Mekan1206
2026-07-31 23:40:35 +05:00
parent 581cb8241c
commit 20d032c4cc
83 changed files with 4386 additions and 39 deletions

View File

@@ -37,6 +37,7 @@ use App\Policies\UserPolicy;
use App\Policies\VacationPolicy;
use BezhanSalleh\LanguageSwitch\Events\LocaleChanged;
use BezhanSalleh\LanguageSwitch\LanguageSwitch;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
@@ -81,11 +82,11 @@ class AppServiceProvider extends ServiceProvider
->locales(config('hr.supported_locales'))
->labels(config('hr.locale_labels'))
->displayLocale('native')
->userPreferredLocale(fn () => auth()->user()?->locale);
->userPreferredLocale(fn () => user()->locale);
});
Event::listen(function (LocaleChanged $event): void {
auth()->user()?->update(['locale' => $event->locale]);
user()->update(['locale' => $event->locale]);
});
}
}