You've already forked Epicnabbo-Catalogus-Updated-Daily
88 lines
2.2 KiB
PHP
88 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Atom;
|
|
|
|
use App\Filament\Resources\Atom\WriteableBoxResource\Pages\ManageWriteableBoxes;
|
|
use App\Filament\Traits\TranslatableResource;
|
|
use App\Models\WebsiteWriteableBox;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class WriteableBoxResource extends Resource
|
|
{
|
|
use TranslatableResource;
|
|
|
|
protected static ?string $model = WebsiteWriteableBox::class;
|
|
|
|
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-pencil-square';
|
|
|
|
protected static string|\UnitEnum|null $navigationGroup = 'Website';
|
|
|
|
protected static ?string $slug = 'website/writeable-boxes';
|
|
|
|
public static string $translateIdentifier = 'writeable-boxes';
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components(static::getForm());
|
|
}
|
|
|
|
public static function getForm(): array
|
|
{
|
|
return [
|
|
TextInput::make('title')
|
|
->label(__('Title'))
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
Textarea::make('content')
|
|
->label(__('Content'))
|
|
->required(),
|
|
|
|
TextInput::make('order')
|
|
->label(__('Order'))
|
|
->numeric()
|
|
->default(0),
|
|
];
|
|
}
|
|
|
|
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('title')
|
|
->label(__('Title'))
|
|
->searchable(),
|
|
|
|
TextColumn::make('order')
|
|
->label(__('Order'))
|
|
->sortable(),
|
|
|
|
TextColumn::make('created_at')
|
|
->label(__('Created'))
|
|
->dateTime(),
|
|
];
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => ManageWriteableBoxes::route('/'),
|
|
];
|
|
}
|
|
}
|