modify translations 🤦
This commit is contained in:
@@ -23,6 +23,7 @@ class User extends Authenticatable
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'locale',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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
21
app/Rules/OnlyLetters.php
Normal 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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user