add types

This commit is contained in:
2024-05-06 17:13:38 +05:00
parent 88b934bda1
commit e5907fe3a9
46 changed files with 465 additions and 184 deletions

View File

@@ -6,6 +6,8 @@ class CountryRepo
{
/**
* List of countries
*
* @return array<string, string>
*/
public static function values(): array
{

View File

@@ -26,6 +26,8 @@ class NovaMenuRepo
{
/**
* Nova menu items
*
* @return array<int, \Laravel\Nova\Menu\MenuSection>
*/
public static function items(Request $request): array
{

View File

@@ -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]);
}
};
}

View File

@@ -20,6 +20,8 @@ class EducationRepo
/**
* Education statuses
*
* @return array<string, string>
*/
public static function values(): array
{

View File

@@ -16,6 +16,8 @@ class MarriageRepo
/**
* Marriage values
*
* @return array<string, string>
*/
public static function values(): array
{

View File

@@ -28,6 +28,8 @@ class PassportRepo
/**
* Passport values
*
* @return array<string, string>
*/
public static function values(): array
{

View File

@@ -41,6 +41,8 @@ class RegionRepo
/**
* Regions
*
* @return array<string, string>
*/
public static function values(): array
{