This commit is contained in:
f4ilji
2024-11-17 01:33:09 +05:00
parent 7b9dc03420
commit af69b48247
33 changed files with 367 additions and 210 deletions
+11 -6
View File
@@ -25,6 +25,7 @@ class MainSectionResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-folder';
public static ?string $label = 'Главный раздел';
public static ?string $pluralLabel = 'Главные разделы';
@@ -40,12 +41,16 @@ class MainSectionResource extends Resource
{
return $form
->schema([
Forms\Components\TextInput::make('title')->label('Название раздела')->required()
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string $state, Forms\Set $set) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')->label('Slug')->unique(ignoreRecord: true)->readOnly()->required(),
Forms\Components\Section::make()->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('title')->label('Название раздела')->required()
->live(onBlur: true)
->afterStateUpdated(function (string $operation, string|null $state, Forms\Set $set) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')->label('Текстовый идентификатор раздела')->unique(ignoreRecord: true)->readOnly()->required(),
]),
]),
]);
}