Refactor and localize settings and resources
- Updated GeneralSettings page to include localized labels and structured sections for better organization. - Enhanced CarouselSlide, Category, Collection, and Product resources with localized model labels and improved form/table configurations. - Modified HomeController to utilize query builder for better performance and added collection items retrieval. - Updated views to reflect localized settings and improved layout for collections and footer. - Adjusted timezone and locale settings in app configuration for better regional support.
This commit is contained in:
@@ -11,14 +11,17 @@ use App\Models\Collection;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CollectionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Collection::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
protected static ?string $modelLabel = 'Kolleksiýa';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Kolleksiýalar';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-rectangle-group';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
@@ -33,7 +36,7 @@ class CollectionResource extends Resource
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
RelationManagers\CollectionItemsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Collections\RelationManagers;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CollectionItemsRelationManager extends RelationManager
|
||||
{
|
||||
protected static string $relationship = 'collectionItems';
|
||||
|
||||
protected static ?string $title = 'Kolleksiýa elementleri';
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->columns(4)
|
||||
->components([
|
||||
TextInput::make('title')
|
||||
->label('Sözbaşy')
|
||||
->required(),
|
||||
TextInput::make('subtitle')
|
||||
->label('Sözbaşy asty'),
|
||||
TextInput::make('order')
|
||||
->label('Tertibi')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeňmi')
|
||||
->default(true)
|
||||
->required(),
|
||||
FileUpload::make('image')
|
||||
->label('Suraty')
|
||||
->image()
|
||||
->visibility('public')
|
||||
->columnSpan(2),
|
||||
]);
|
||||
}
|
||||
|
||||
public function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->recordTitleAttribute('title')
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Suraty'),
|
||||
TextColumn::make('title')
|
||||
->label('Sözbaşy')
|
||||
->searchable(),
|
||||
TextColumn::make('subtitle')
|
||||
->label('Sözbaşy asty')
|
||||
->searchable(),
|
||||
TextColumn::make('order')
|
||||
->label('Tertibi')
|
||||
->sortable(),
|
||||
ToggleColumn::make('is_active')
|
||||
->label('Işjeňmi'),
|
||||
])
|
||||
->defaultSort('order')
|
||||
->reorderable('order')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
CreateAction::make(),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Collections\Schemas;
|
||||
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Schema;
|
||||
@@ -14,16 +13,18 @@ class CollectionForm
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('title')
|
||||
->label('Sözbaşy')
|
||||
->required(),
|
||||
TextInput::make('subtitle'),
|
||||
FileUpload::make('image')
|
||||
->image()
|
||||
->visibility('public'),
|
||||
TextInput::make('subtitle')
|
||||
->label('Sözbaşy asty'),
|
||||
TextInput::make('order')
|
||||
->label('Tertibi')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeňmi')
|
||||
->default(true)
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
@@ -17,20 +16,25 @@ class CollectionsTable
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('title')
|
||||
->label('Sözbaşy')
|
||||
->searchable(),
|
||||
TextColumn::make('subtitle')
|
||||
->label('Sözbaşy asty')
|
||||
->searchable(),
|
||||
ImageColumn::make('image'),
|
||||
TextColumn::make('order')
|
||||
->label('Tertibi')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeňmi')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->label('Döredilen wagty')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->label('Üýtgedilen wagty')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
Reference in New Issue
Block a user