You've already forked Epicnabbo-Catalogus-Updated-Daily
🆙 Add fixed cms 🆙
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Atom;
|
||||
|
||||
use App\Filament\Resources\Atom\NavigationResource\Pages\CreateNavigation;
|
||||
use App\Filament\Resources\Atom\NavigationResource\Pages\EditNavigation;
|
||||
use App\Filament\Resources\Atom\NavigationResource\Pages\ListNavigations;
|
||||
use App\Filament\Resources\Atom\NavigationResource\RelationManagers\SubNavigationsRelationManager;
|
||||
use App\Filament\Traits\TranslatableResource;
|
||||
use App\Models\WebsiteNavigation;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class NavigationResource extends Resource
|
||||
{
|
||||
use TranslatableResource;
|
||||
|
||||
protected static ?string $model = WebsiteNavigation::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-bars-3';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Website';
|
||||
|
||||
protected static ?string $slug = 'website/navigations';
|
||||
|
||||
public static string $translateIdentifier = 'navigations';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components(static::getForm());
|
||||
}
|
||||
|
||||
public static function getForm(): array
|
||||
{
|
||||
return [
|
||||
TextInput::make('name')
|
||||
->label(__('Name'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('url')
|
||||
->label(__('URL'))
|
||||
->required()
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('icon')
|
||||
->label(__('Icon'))
|
||||
->maxLength(255),
|
||||
|
||||
TextInput::make('order')
|
||||
->label(__('Order'))
|
||||
->numeric()
|
||||
->default(0),
|
||||
|
||||
Select::make('parent_id')
|
||||
->label(__('Parent Navigation'))
|
||||
->relationship('parent', 'name')
|
||||
->nullable(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns(static::getTable());
|
||||
}
|
||||
|
||||
public static function getTable(): array
|
||||
{
|
||||
return [
|
||||
TextColumn::make('id')
|
||||
->label(__('ID'))
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('name')
|
||||
->label(__('Name'))
|
||||
->searchable(),
|
||||
|
||||
TextColumn::make('url')
|
||||
->label(__('URL')),
|
||||
|
||||
TextColumn::make('order')
|
||||
->label(__('Order'))
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('parent.name')
|
||||
->label(__('Parent')),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
SubNavigationsRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListNavigations::route('/'),
|
||||
'create' => CreateNavigation::route('/create'),
|
||||
'edit' => EditNavigation::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user