add types
This commit is contained in:
@@ -6,6 +6,8 @@ class CountryRepo
|
||||
{
|
||||
/**
|
||||
* List of countries
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
|
||||
@@ -26,6 +26,8 @@ class NovaMenuRepo
|
||||
{
|
||||
/**
|
||||
* Nova menu items
|
||||
*
|
||||
* @return array<int, \Laravel\Nova\Menu\MenuSection>
|
||||
*/
|
||||
public static function items(Request $request): array
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ class NovaRepo
|
||||
*/
|
||||
public static function serving(ServingNova $event): void
|
||||
{
|
||||
// static::setLocale($event);
|
||||
static::setLocale($event);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,11 +44,11 @@ class NovaRepo
|
||||
/**
|
||||
* Set locales
|
||||
*/
|
||||
public static function setLocale($event): void
|
||||
public static function setLocale(ServingNova $event): void
|
||||
{
|
||||
$user = $event->request->user();
|
||||
|
||||
if (array_key_exists($user?->locale, config('app.locales'))) {
|
||||
if ($user && array_key_exists($user->locale, config('app.locales'))) {
|
||||
app()->setLocale($user->locale);
|
||||
}
|
||||
}
|
||||
@@ -61,8 +61,8 @@ class NovaRepo
|
||||
return function (Request $request) {
|
||||
$locale = $request->post('locale');
|
||||
|
||||
if (array_key_exists($locale, config('app.locales'))) {
|
||||
$request->user()->update(['locale' => $locale]);
|
||||
if (is_string($locale) && array_key_exists($locale, config('app.locales'))) {
|
||||
$request->user()?->update(['locale' => $locale]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ class EducationRepo
|
||||
|
||||
/**
|
||||
* Education statuses
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
|
||||
@@ -16,6 +16,8 @@ class MarriageRepo
|
||||
|
||||
/**
|
||||
* Marriage values
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
|
||||
@@ -28,6 +28,8 @@ class PassportRepo
|
||||
|
||||
/**
|
||||
* Passport values
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
|
||||
@@ -41,6 +41,8 @@ class RegionRepo
|
||||
|
||||
/**
|
||||
* Regions
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function values(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user