modify translations 🤦

This commit is contained in:
2023-11-28 17:31:52 +05:00
parent 45b42d47e8
commit af9afd5113
28 changed files with 3240 additions and 956 deletions

View File

@@ -23,6 +23,7 @@ class User extends Authenticatable
'name',
'email',
'password',
'locale',
];
/**

View File

@@ -5,6 +5,7 @@ namespace App\Nova\Resources;
use App\Nova\Resource;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Http\Requests\NovaRequest;
use Nurmuhammet\NovaInputmask\NovaInputmask;
@@ -44,6 +45,8 @@ class Test extends Resource
return [
ID::make()->sortable(),
Text::make('phone'),
// NovaInputmask::make('Phone', 'phone')
// ->mask('+(\\9\\93)-69-99-99-99')
// ->storeRawValue(),

View File

@@ -25,7 +25,7 @@ class NovaRepo
$user = $event->request->user();
if (array_key_exists($user?->locale, config('app.locales'))) {
app()->setLocale($user->locale);
app()->setLocale($user->locale);
}
}
@@ -49,7 +49,6 @@ class NovaRepo
public static function dependsOnRegion(string $attribute = 'region', string $model = Province::class): Closure
{
return function ($field, $request, $formData) use ($attribute, $model) {
info($formData->{$attribute});
$field->options(
$formData->{$attribute}
? $model::where('region', $formData->{$attribute})->pluck('name', 'id')

21
app/Rules/OnlyLetters.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
class OnlyLetters implements ValidationRule
{
/**
* Run the validation rule.
*
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
*/
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (! preg_match('/^([a-zA-Zа-яZžŽäÄňŇöÖşŞüÜçÇýÝ])+$/', $value)) {
$fail('The :attribute field must only contain letters.');
}
}
}