migrate template
This commit is contained in:
111
app/Filament/Pages/SiteSettingsPage.php
Normal file
111
app/Filament/Pages/SiteSettingsPage.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Models\SiteSetting;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Components\Form;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class SiteSettingsPage extends Page
|
||||
{
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedCog6Tooth;
|
||||
|
||||
protected static ?string $navigationLabel = 'Sahypa sazlamalary';
|
||||
|
||||
protected static \UnitEnum|string|null $navigationGroup = null;
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
protected string $view = 'filament.pages.site-settings-page';
|
||||
|
||||
/** @var array<string, mixed>|null */
|
||||
public ?array $data = [];
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->data = SiteSetting::pluck('value', 'key')->toArray();
|
||||
$this->form->fill($this->data);
|
||||
}
|
||||
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->statePath('data')
|
||||
->components([
|
||||
Form::make()
|
||||
->schema([
|
||||
Tabs::make()
|
||||
->tabs([
|
||||
Tabs\Tab::make('Kesimçiniň hekaýasy')
|
||||
->schema([
|
||||
TextInput::make('butchers_tale_title')
|
||||
->label('Bölüm başlygy')
|
||||
->required(),
|
||||
Textarea::make('butchers_tale_body')
|
||||
->label('Tekst')
|
||||
->rows(5)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('butchers_tale_image')
|
||||
->label('Surat (gollar)')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('settings')
|
||||
->columnSpanFull(),
|
||||
]),
|
||||
Tabs\Tab::make('Footer')
|
||||
->schema([
|
||||
TextInput::make('footer_brand_name')
|
||||
->label('Brend ady')
|
||||
->required(),
|
||||
TextInput::make('footer_copyright')
|
||||
->label('Awtorlyk hukugy ýazgysy')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('footer_address')
|
||||
->label('Salgy'),
|
||||
TextInput::make('footer_email')
|
||||
->label('E-poçta')
|
||||
->email(),
|
||||
TextInput::make('footer_phone')
|
||||
->label('Telefon')
|
||||
->tel(),
|
||||
]),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
])
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$state = $this->form->getState();
|
||||
|
||||
foreach ($state as $key => $value) {
|
||||
SiteSetting::updateOrCreate(['key' => $key], ['value' => $value]);
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Sazlamalar saklanyldy.')
|
||||
->success()
|
||||
->send();
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Action::make('save')
|
||||
->label('Saklamak')
|
||||
->action('save'),
|
||||
];
|
||||
}
|
||||
}
|
||||
104
app/Filament/Resources/Categories/CategoryResource.php
Normal file
104
app/Filament/Resources/Categories/CategoryResource.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Categories;
|
||||
|
||||
use App\Filament\Resources\Categories\Pages\ManageCategories;
|
||||
use App\Models\Category;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class CategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Category::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedSquares2x2;
|
||||
|
||||
protected static ?string $navigationLabel = 'Kategoriýalar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Harytlar';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Ady')
|
||||
->required()
|
||||
->live(onBlur: true),
|
||||
TextInput::make('slug')
|
||||
->label('Slug')
|
||||
->required()
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('icon')
|
||||
->label('Material Symbol ikony')
|
||||
->required()
|
||||
->default('category')
|
||||
->placeholder('set_meal'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->label('Ady')
|
||||
->searchable(),
|
||||
TextColumn::make('slug')
|
||||
->label('Slug')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->label('Ikony'),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageCategories::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Categories/Pages/ManageCategories.php
Normal file
19
app/Filament/Resources/Categories/Pages/ManageCategories.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Categories\Pages;
|
||||
|
||||
use App\Filament\Resources\Categories\CategoryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageCategories extends ManageRecords
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FooterNavLinks;
|
||||
|
||||
use App\Filament\Resources\FooterNavLinks\Pages\ManageFooterNavLinks;
|
||||
use App\Models\FooterNavLink;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class FooterNavLinkResource extends Resource
|
||||
{
|
||||
protected static ?string $model = FooterNavLink::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedLink;
|
||||
|
||||
protected static ?string $navigationLabel = 'Footer baglanyşyklary';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('label')
|
||||
->label('Ýazgy')
|
||||
->required(),
|
||||
TextInput::make('url')
|
||||
->label('URL')
|
||||
->required()
|
||||
->url(),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('label')
|
||||
->label('Ýazgy')
|
||||
->searchable(),
|
||||
TextColumn::make('url')
|
||||
->label('URL')
|
||||
->searchable(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageFooterNavLinks::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\FooterNavLinks\Pages;
|
||||
|
||||
use App\Filament\Resources\FooterNavLinks\FooterNavLinkResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageFooterNavLinks extends ManageRecords
|
||||
{
|
||||
protected static string $resource = FooterNavLinkResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
115
app/Filament/Resources/HeroSlides/HeroSlideResource.php
Normal file
115
app/Filament/Resources/HeroSlides/HeroSlideResource.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\HeroSlides;
|
||||
|
||||
use App\Filament\Resources\HeroSlides\Pages\ManageHeroSlides;
|
||||
use App\Models\HeroSlide;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class HeroSlideResource extends Resource
|
||||
{
|
||||
protected static ?string $model = HeroSlide::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedPhoto;
|
||||
|
||||
protected static ?string $navigationLabel = 'Hero Slaýdlary';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('headline')
|
||||
->label('Sözbaşy')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
Textarea::make('subheadline')
|
||||
->label('Ikinji sözbaşy')
|
||||
->rows(2)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('cta_label')
|
||||
->label('Düwme ýazgysy'),
|
||||
TextInput::make('cta_url')
|
||||
->label('Düwme URL')
|
||||
->url(),
|
||||
FileUpload::make('image')
|
||||
->label('Surat')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('hero-slides')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Surat')
|
||||
->square(),
|
||||
TextColumn::make('headline')
|
||||
->label('Sözbaşy')
|
||||
->searchable()
|
||||
->limit(40),
|
||||
TextColumn::make('cta_label')
|
||||
->label('Düwme')
|
||||
->searchable(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageHeroSlides::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/HeroSlides/Pages/ManageHeroSlides.php
Normal file
19
app/Filament/Resources/HeroSlides/Pages/ManageHeroSlides.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\HeroSlides\Pages;
|
||||
|
||||
use App\Filament\Resources\HeroSlides\HeroSlideResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageHeroSlides extends ManageRecords
|
||||
{
|
||||
protected static string $resource = HeroSlideResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
19
app/Filament/Resources/Products/Pages/ManageProducts.php
Normal file
19
app/Filament/Resources/Products/Pages/ManageProducts.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Products\Pages;
|
||||
|
||||
use App\Filament\Resources\Products\ProductResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageProducts extends ManageRecords
|
||||
{
|
||||
protected static string $resource = ProductResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
172
app/Filament/Resources/Products/ProductResource.php
Normal file
172
app/Filament/Resources/Products/ProductResource.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Products;
|
||||
|
||||
use App\Filament\Resources\Products\Pages\ManageProducts;
|
||||
use App\Models\Product;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class ProductResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Product::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShoppingBag;
|
||||
|
||||
protected static ?string $navigationLabel = 'Harytlar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Harytlar';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('category_id')
|
||||
->label('Kategoriýa')
|
||||
->relationship('category', 'name')
|
||||
->required()
|
||||
->searchable()
|
||||
->preload(),
|
||||
TextInput::make('name')
|
||||
->label('Ady')
|
||||
->required(),
|
||||
TextInput::make('slug')
|
||||
->label('Slug')
|
||||
->required()
|
||||
->unique(ignoreRecord: true),
|
||||
TextInput::make('price')
|
||||
->label('Bahasy')
|
||||
->required()
|
||||
->numeric()
|
||||
->prefix('TMT'),
|
||||
TextInput::make('price_unit')
|
||||
->label('Baha birligi')
|
||||
->required()
|
||||
->default('kg')
|
||||
->placeholder('kg, sany, gram'),
|
||||
Select::make('availability_status')
|
||||
->label('Elýeterliligi')
|
||||
->required()
|
||||
->options([
|
||||
'available' => 'Elýeterli',
|
||||
'out_of_season' => 'Möwsümden daşary',
|
||||
'low_stock' => 'Az galdy',
|
||||
])
|
||||
->default('available'),
|
||||
Textarea::make('description')
|
||||
->label('Beýany')
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('image')
|
||||
->label('Surat')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('products')
|
||||
->columnSpanFull(),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Surat')
|
||||
->square(),
|
||||
TextColumn::make('name')
|
||||
->label('Ady')
|
||||
->searchable(),
|
||||
TextColumn::make('category.name')
|
||||
->label('Kategoriýa')
|
||||
->badge()
|
||||
->sortable(),
|
||||
TextColumn::make('price')
|
||||
->label('Bahasy')
|
||||
->formatStateUsing(fn ($state) => number_format($state, 2).' TMT')
|
||||
->sortable(),
|
||||
TextColumn::make('price_unit')
|
||||
->label('Birlik'),
|
||||
TextColumn::make('availability_status')
|
||||
->label('Elýeterliligi')
|
||||
->badge()
|
||||
->color(fn (string $state): string => match ($state) {
|
||||
'available' => 'success',
|
||||
'out_of_season' => 'warning',
|
||||
'low_stock' => 'danger',
|
||||
default => 'gray',
|
||||
})
|
||||
->formatStateUsing(fn (string $state): string => match ($state) {
|
||||
'available' => 'Elýeterli',
|
||||
'out_of_season' => 'Möwsümden daşary',
|
||||
'low_stock' => 'Az galdy',
|
||||
default => $state,
|
||||
}),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([
|
||||
SelectFilter::make('category')
|
||||
->relationship('category', 'name')
|
||||
->label('Kategoriýa'),
|
||||
SelectFilter::make('availability_status')
|
||||
->options([
|
||||
'available' => 'Elýeterli',
|
||||
'out_of_season' => 'Möwsümden daşary',
|
||||
'low_stock' => 'Az galdy',
|
||||
])
|
||||
->label('Elýeterliligi'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageProducts::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SignatureItems\Pages;
|
||||
|
||||
use App\Filament\Resources\SignatureItems\SignatureItemResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageSignatureItems extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SignatureItemResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
120
app/Filament/Resources/SignatureItems/SignatureItemResource.php
Normal file
120
app/Filament/Resources/SignatureItems/SignatureItemResource.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SignatureItems;
|
||||
|
||||
use App\Filament\Resources\SignatureItems\Pages\ManageSignatureItems;
|
||||
use App\Models\SignatureItem;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SignatureItemResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SignatureItem::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedStar;
|
||||
|
||||
protected static ?string $navigationLabel = 'Aýratynlyklar';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label('Ady')
|
||||
->required(),
|
||||
TextInput::make('price')
|
||||
->label('Bahasy')
|
||||
->required()
|
||||
->numeric()
|
||||
->prefix('TMT'),
|
||||
TextInput::make('price_unit')
|
||||
->label('Baha birligi')
|
||||
->required()
|
||||
->default('kg'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Toggle::make('is_active')
|
||||
->label('Işjeň')
|
||||
->default(true),
|
||||
Textarea::make('description')
|
||||
->label('Beýany')
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
FileUpload::make('image')
|
||||
->label('Surat')
|
||||
->image()
|
||||
->disk('public')
|
||||
->directory('signature-items')
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
ImageColumn::make('image')
|
||||
->label('Surat')
|
||||
->square(),
|
||||
TextColumn::make('name')
|
||||
->label('Ady')
|
||||
->searchable(),
|
||||
TextColumn::make('price')
|
||||
->label('Bahasy')
|
||||
->formatStateUsing(fn ($state) => number_format($state, 2).' TMT / ')
|
||||
->sortable(),
|
||||
TextColumn::make('price_unit')
|
||||
->label('Birlik'),
|
||||
IconColumn::make('is_active')
|
||||
->label('Işjeň')
|
||||
->boolean(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageSignatureItems::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SocialLinks\Pages;
|
||||
|
||||
use App\Filament\Resources\SocialLinks\SocialLinkResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageSocialLinks extends ManageRecords
|
||||
{
|
||||
protected static string $resource = SocialLinkResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
95
app/Filament/Resources/SocialLinks/SocialLinkResource.php
Normal file
95
app/Filament/Resources/SocialLinks/SocialLinkResource.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SocialLinks;
|
||||
|
||||
use App\Filament\Resources\SocialLinks\Pages\ManageSocialLinks;
|
||||
use App\Models\SocialLink;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SocialLinkResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SocialLink::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedShare;
|
||||
|
||||
protected static ?string $navigationLabel = 'Sosial mediýa';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('platform')
|
||||
->label('Platforma')
|
||||
->required()
|
||||
->placeholder('Instagram'),
|
||||
TextInput::make('url')
|
||||
->label('URL')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->label('Material Symbol ikony')
|
||||
->required()
|
||||
->default('link')
|
||||
->placeholder('photo_camera'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('platform')
|
||||
->label('Platforma')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->label('Ikony'),
|
||||
TextColumn::make('url')
|
||||
->label('URL')
|
||||
->searchable(),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageSocialLinks::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TimelineEntries\Pages;
|
||||
|
||||
use App\Filament\Resources\TimelineEntries\TimelineEntryResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageTimelineEntries extends ManageRecords
|
||||
{
|
||||
protected static string $resource = TimelineEntryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
103
app/Filament/Resources/TimelineEntries/TimelineEntryResource.php
Normal file
103
app/Filament/Resources/TimelineEntries/TimelineEntryResource.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TimelineEntries;
|
||||
|
||||
use App\Filament\Resources\TimelineEntries\Pages\ManageTimelineEntries;
|
||||
use App\Models\TimelineEntry;
|
||||
use BackedEnum;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class TimelineEntryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TimelineEntry::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedClock;
|
||||
|
||||
protected static ?string $navigationLabel = 'Taryh';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Sahypa mazmunu';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('year')
|
||||
->label('Ýyly')
|
||||
->required()
|
||||
->numeric()
|
||||
->minValue(1900)
|
||||
->maxValue(2100),
|
||||
TextInput::make('title')
|
||||
->label('Başlyk')
|
||||
->required(),
|
||||
TextInput::make('icon')
|
||||
->label('Material Symbol ikony')
|
||||
->required()
|
||||
->default('history')
|
||||
->placeholder('storefront'),
|
||||
TextInput::make('sort_order')
|
||||
->label('Tertip')
|
||||
->required()
|
||||
->numeric()
|
||||
->default(0),
|
||||
Textarea::make('body')
|
||||
->label('Tekst')
|
||||
->required()
|
||||
->rows(3)
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('year')
|
||||
->label('Ýyly')
|
||||
->sortable(),
|
||||
TextColumn::make('title')
|
||||
->label('Başlyk')
|
||||
->searchable(),
|
||||
TextColumn::make('icon')
|
||||
->label('Ikony'),
|
||||
TextColumn::make('sort_order')
|
||||
->label('Tertip')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->defaultSort('sort_order')
|
||||
->filters([])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ManageTimelineEntries::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user