mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
section basic
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\AudioCodecResource\Pages;
|
||||
use App\Filament\Resources\Section\AudioCodecResource\RelationManagers;
|
||||
use App\Models\AudioCodec;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class AudioCodecResource extends CodecResource
|
||||
{
|
||||
protected static ?string $model = AudioCodec::class;
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return parent::form($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return parent::table($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAudioCodecs::route('/'),
|
||||
'create' => Pages\CreateAudioCodec::route('/create'),
|
||||
'edit' => Pages\EditAudioCodec::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\AudioCodecResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\AudioCodecResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateAudioCodec extends CreateRecord
|
||||
{
|
||||
protected static string $resource = AudioCodecResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\AudioCodecResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\AudioCodecResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditAudioCodec extends EditRecord
|
||||
{
|
||||
protected static string $resource = AudioCodecResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\AudioCodecResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\AudioCodecResource;
|
||||
use App\Models\AudioCodec;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListAudioCodecs extends PageList
|
||||
{
|
||||
protected static string $resource = AudioCodecResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return AudioCodec::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\CategoryResource\Pages;
|
||||
use App\Filament\Resources\Section\CategoryResource\RelationManagers;
|
||||
use App\Models\Category;
|
||||
use App\Models\Icon;
|
||||
use App\Models\SearchBox;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CategoryResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Category::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-collection';
|
||||
|
||||
protected static ?string $navigationGroup = 'Section';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.category');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('mode')
|
||||
->options(SearchBox::query()->pluck('name', 'id')->toArray())
|
||||
->label(__('label.search_box.label'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
|
||||
Forms\Components\TextInput::make('image')
|
||||
->label(__('label.search_box.taxonomy.image'))
|
||||
->helperText(__('label.search_box.taxonomy.image_help'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\Select::make('icon_id')
|
||||
->options(Icon::query()->pluck('name', 'id')->toArray())
|
||||
->label(__('label.search_box.taxonomy.icon_id'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('class_name')
|
||||
->label(__('label.search_box.taxonomy.class_name'))
|
||||
->helperText(__('label.search_box.taxonomy.class_name_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('sort_index')
|
||||
->default(0)
|
||||
->label(__('label.search_box.taxonomy.sort_index'))
|
||||
->helperText(__('label.search_box.taxonomy.sort_index_help'))
|
||||
,
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('search_box.name')->label(__('label.search_box.label')),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(),
|
||||
Tables\Columns\TextColumn::make('icon.name')->label(__('label.search_box.taxonomy.icon_id')),
|
||||
Tables\Columns\TextColumn::make('image')->label(__('label.search_box.taxonomy.image')),
|
||||
Tables\Columns\TextColumn::make('class_name')->label(__('label.search_box.taxonomy.class_name')),
|
||||
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
|
||||
])
|
||||
->defaultSort('sort_index', 'asc')
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('mode')
|
||||
->options(SearchBox::query()->pluck('name', 'id')->toArray())
|
||||
->label(__('label.search_box.label'))
|
||||
,
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListCategories::route('/'),
|
||||
'create' => Pages\CreateCategory::route('/create'),
|
||||
'edit' => Pages\EditCategory::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\CategoryResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCategory extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\CategoryResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCategory extends EditRecord
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\CategoryResource;
|
||||
use App\Models\Category;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListCategories extends PageList
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Category::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\CodecResource\Pages;
|
||||
use App\Filament\Resources\Section\CodecResource\RelationManagers;
|
||||
use App\Models\Codec;
|
||||
use App\Models\Icon;
|
||||
use App\Models\SearchBox;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class CodecResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Codec::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-bookmark';
|
||||
|
||||
protected static ?string $navigationGroup = 'Section';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
|
||||
Forms\Components\TextInput::make('sort_index')
|
||||
->default(0)
|
||||
->label(__('label.search_box.taxonomy.sort_index'))
|
||||
->helperText(__('label.search_box.taxonomy.sort_index_help'))
|
||||
,
|
||||
Forms\Components\Select::make('mode')
|
||||
->options(SearchBox::query()->pluck('name', 'id')->toArray())
|
||||
->label(__('label.search_box.taxonomy.mode'))
|
||||
->helperText(__('label.search_box.taxonomy.mode_help'))
|
||||
,
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('search_box.name')
|
||||
->label(__('label.search_box.label'))
|
||||
->formatStateUsing(fn ($record) => $record->search_box->name ?? 'All')
|
||||
,
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.taxonomy.name'))->searchable(),
|
||||
Tables\Columns\TextColumn::make('sort_index')->label(__('label.search_box.taxonomy.sort_index'))->sortable(),
|
||||
])
|
||||
->defaultSort('sort_index', 'asc')
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('mode')
|
||||
->options(SearchBox::query()->pluck('name', 'id')->toArray())
|
||||
->label(__('label.search_box.taxonomy.mode'))
|
||||
->query(function (Builder $query, array $data) {
|
||||
return $query->where(function (Builder $query) use ($data) {
|
||||
return $query->where('mode', 0)->orWhere('mode', $data['value']);
|
||||
});
|
||||
})
|
||||
,
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListCodecs::route('/'),
|
||||
'create' => Pages\CreateCodec::route('/create'),
|
||||
'edit' => Pages\EditCodec::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\CodecResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\CodecResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCodec extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CodecResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\CodecResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\CodecResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCodec extends EditRecord
|
||||
{
|
||||
protected static string $resource = CodecResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\CodecResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\CodecResource;
|
||||
use App\Models\Codec;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListCodecs extends PageList
|
||||
{
|
||||
protected static string $resource = CodecResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Codec::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\Section\IconResource\Pages;
|
||||
use App\Filament\Resources\Section\IconResource\RelationManagers;
|
||||
use App\Models\Icon;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class IconResource extends Resource
|
||||
{
|
||||
use OptionsTrait;
|
||||
|
||||
protected static ?string $model = Icon::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-ticket';
|
||||
|
||||
protected static ?string $navigationGroup = 'Section';
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
protected static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.icon');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label(__('label.name'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('folder')
|
||||
->label(__('label.icon.folder'))
|
||||
->required()
|
||||
->helperText(__('label.icon.folder_help'))
|
||||
,
|
||||
Forms\Components\Radio::make('multilang')
|
||||
->label(__('label.icon.multilang'))
|
||||
->options(self::$yesOrNo)
|
||||
->required()
|
||||
->helperText(__('label.icon.multilang_help'))
|
||||
,
|
||||
Forms\Components\Radio::make('secondicon')
|
||||
->label(__('label.icon.secondicon'))
|
||||
->options(self::$yesOrNo)
|
||||
->required()
|
||||
->helperText(__('label.icon.secondicon_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('cssfile')->label(__('label.icon.cssfile'))->helperText(__('label.icon.cssfile_help')),
|
||||
Forms\Components\TextInput::make('designer')->label(__('label.icon.designer'))->helperText(__('label.icon.designer_help')),
|
||||
Forms\Components\Textarea::make('comment')->label(__('label.icon.comment'))->helperText(__('label.icon.comment_help')),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name'),
|
||||
Tables\Columns\TextColumn::make('folder'),
|
||||
Tables\Columns\TextColumn::make('cssfile'),
|
||||
Tables\Columns\TextColumn::make('multilang'),
|
||||
Tables\Columns\TextColumn::make('secondicon'),
|
||||
Tables\Columns\TextColumn::make('designer'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListIcons::route('/'),
|
||||
'create' => Pages\CreateIcon::route('/create'),
|
||||
'edit' => Pages\EditIcon::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\IconResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\IconResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateIcon extends CreateRecord
|
||||
{
|
||||
protected static string $view = 'filament.resources.system.category-icon-resource.pages.create-record';
|
||||
|
||||
protected static string $resource = IconResource::class;
|
||||
|
||||
protected function getViewData(): array
|
||||
{
|
||||
return [
|
||||
'desc' => nexus_trans('label.icon.desc')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\IconResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\IconResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditIcon extends EditRecord
|
||||
{
|
||||
protected static string $resource = IconResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.system.category-icon-resource.pages.edit-record';
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getViewData(): array
|
||||
{
|
||||
return [
|
||||
'desc' => nexus_trans('label.icon.desc')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\IconResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\IconResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListIcons extends PageList
|
||||
{
|
||||
protected static string $resource = IconResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\MediaResource\Pages;
|
||||
use App\Filament\Resources\Section\MediaResource\RelationManagers;
|
||||
use App\Models\Media;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class MediaResource extends CodecResource
|
||||
{
|
||||
protected static ?string $model = Media::class;
|
||||
|
||||
protected static ?int $navigationSort = 8;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return parent::form($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return parent::table($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListMedia::route('/'),
|
||||
'create' => Pages\CreateMedia::route('/create'),
|
||||
'edit' => Pages\EditMedia::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\MediaResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\MediaResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateMedia extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MediaResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\MediaResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\MediaResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditMedia extends EditRecord
|
||||
{
|
||||
protected static string $resource = MediaResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\MediaResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\MediaResource;
|
||||
use App\Models\Media;
|
||||
use App\Models\Source;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListMedia extends PageList
|
||||
{
|
||||
protected static string $resource = MediaResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Media::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\ProcessingResource\Pages;
|
||||
use App\Filament\Resources\Section\ProcessingResource\RelationManagers;
|
||||
use App\Models\Processing;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class ProcessingResource extends CodecResource
|
||||
{
|
||||
protected static ?string $model = Processing::class;
|
||||
|
||||
protected static ?int $navigationSort = 9;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return parent::form($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return parent::table($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListProcessings::route('/'),
|
||||
'create' => Pages\CreateProcessing::route('/create'),
|
||||
'edit' => Pages\EditProcessing::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\ProcessingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\ProcessingResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateProcessing extends CreateRecord
|
||||
{
|
||||
protected static string $resource = ProcessingResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\ProcessingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\ProcessingResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditProcessing extends EditRecord
|
||||
{
|
||||
protected static string $resource = ProcessingResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\ProcessingResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\ProcessingResource;
|
||||
use App\Models\Processing;
|
||||
use App\Models\Source;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListProcessings extends PageList
|
||||
{
|
||||
protected static string $resource = ProcessingResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Processing::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
use App\Filament\Resources\Section\SecondIconResource\RelationManagers;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\SecondIcon;
|
||||
use App\Models\Setting;
|
||||
use App\Repositories\SearchBoxRepository;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class SecondIconResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SecondIcon::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-ticket';
|
||||
|
||||
protected static ?string $navigationGroup = 'Section';
|
||||
|
||||
protected static ?int $navigationSort = 11;
|
||||
|
||||
protected static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.second_icon');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
$searchBoxRep = new SearchBoxRepository();
|
||||
$torrentMode = Setting::get('main.browsecat');
|
||||
$specialMode = Setting::get('main.specialcat');
|
||||
$torrentTaxonomySchema = $searchBoxRep->listTaxonomyFormSchema($torrentMode);
|
||||
$specialTaxonomySchema = $searchBoxRep->listTaxonomyFormSchema($specialMode);
|
||||
$modeOptions = SearchBox::query()->whereIn('id', [$torrentMode, $specialMode])->pluck('name', 'id')->toArray();
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label(__('label.name'))
|
||||
->required()
|
||||
->helperText(__('label.second_icon.name_help'))
|
||||
,
|
||||
Forms\Components\Select::make('mode')
|
||||
->label(__('label.search_box.label'))
|
||||
->options($modeOptions)
|
||||
->required()
|
||||
->reactive()
|
||||
,
|
||||
Forms\Components\TextInput::make('image')
|
||||
->label(__('label.second_icon.image'))
|
||||
->required()
|
||||
->helperText(__('label.second_icon.image_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('class_name')
|
||||
->label(__('label.second_icon.class_name'))
|
||||
->helperText(__('label.second_icon.class_name_help'))
|
||||
,
|
||||
Forms\Components\Section::make(__('label.second_icon.select_section'))
|
||||
->id("taxonomy_$torrentMode")
|
||||
->schema($torrentTaxonomySchema)
|
||||
->columns(4)
|
||||
->hidden(fn (\Closure $get) => $get('mode') != $torrentMode)
|
||||
,
|
||||
Forms\Components\Section::make(__('label.second_icon.select_section'))
|
||||
->id("taxonomy_$specialMode")
|
||||
->schema($specialTaxonomySchema)
|
||||
->columns(4)
|
||||
->hidden(fn (\Closure $get) => $get('mode') != $specialMode)
|
||||
,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
$columns = [
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('search_box.name')
|
||||
->label(__('label.search_box.label'))
|
||||
->formatStateUsing(fn ($record) => $record->search_box->name ?? 'All')
|
||||
,
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('image')->label(__('label.second_icon.image')),
|
||||
Tables\Columns\TextColumn::make('class_name')->label(__('label.second_icon.class_name')),
|
||||
];
|
||||
$taxonomyList = self::listTaxonomy();
|
||||
foreach (SearchBox::$taxonomies as $torrentField => $tableName) {
|
||||
$columns[] = Tables\Columns\TextColumn::make($torrentField)->formatStateUsing(function ($state) use ($taxonomyList, $torrentField) {
|
||||
return $taxonomyList[$torrentField]->get($state);
|
||||
});
|
||||
}
|
||||
return $table
|
||||
->columns($columns)
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
private static function listTaxonomy()
|
||||
{
|
||||
static $taxonomyList = [];
|
||||
if (empty($taxonomyList)) {
|
||||
foreach (SearchBox::$taxonomies as $torrentField => $tableName) {
|
||||
$taxonomyList[$torrentField] = NexusDB::table($tableName)->pluck('name', 'id');
|
||||
}
|
||||
}
|
||||
return $taxonomyList;
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSecondIcons::route('/'),
|
||||
'create' => Pages\CreateSecondIcon::route('/create'),
|
||||
'edit' => Pages\EditSecondIcon::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SecondIconResource;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\SecondIcon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSecondIcon extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SecondIconResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
return SecondIcon::formatFormData($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SecondIconResource;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\SecondIcon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSecondIcon extends EditRecord
|
||||
{
|
||||
protected static string $resource = SecondIconResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
return SecondIcon::formatFormData($data);
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$mode = $data['mode'];
|
||||
foreach (SearchBox::$taxonomies as $torrentField => $table) {
|
||||
$taxonomyValue = $data[$torrentField] ?? null;
|
||||
unset($data[$torrentField]);
|
||||
$data[$torrentField][$mode] = $taxonomyValue;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\SecondIconResource;
|
||||
use App\Models\SecondIcon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListSecondIcons extends PageList
|
||||
{
|
||||
protected static string $resource = SecondIconResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return SecondIcon::query()->with('search_box');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\System\SectionResource\Pages;
|
||||
use App\Filament\Resources\System\SectionResource\RelationManagers;
|
||||
use App\Http\Middleware\Locale;
|
||||
use App\Models\Forum;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\TorrentCustomField;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class SectionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SearchBox::class;
|
||||
|
||||
protected static ?string $slug = 'sections';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Section';
|
||||
|
||||
protected static ?string $label = 'Section';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-view-boards';
|
||||
|
||||
protected static ?string $navigationGroup = 'Section';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.section');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
private static function buildLocalSchema($name)
|
||||
{
|
||||
$localeSchema = [];
|
||||
foreach (Locale::$languageMaps as $lang => $locale) {
|
||||
$localeSchema[] = Forms\Components\TextInput::make("$name.$lang")->required()->label($lang);
|
||||
}
|
||||
return $localeSchema;
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
$displayTextLocalSchema = self::buildLocalSchema('display_text');
|
||||
$sectionNameLocalSchema = self::buildLocalSchema('section_name');
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
->label(__('label.search_box.name'))
|
||||
->rules('alpha_dash')
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('catsperrow')
|
||||
->label(__('label.search_box.catsperrow'))
|
||||
->helperText(__('label.search_box.catsperrow_help'))
|
||||
->integer()
|
||||
->required()
|
||||
->default(8)
|
||||
,
|
||||
Forms\Components\TextInput::make('catpadding')
|
||||
->label(__('label.search_box.catpadding'))
|
||||
->helperText(__('label.search_box.catpadding_help'))
|
||||
->integer()
|
||||
->required()
|
||||
->default(3)
|
||||
,
|
||||
Forms\Components\CheckboxList::make('custom_fields')
|
||||
->options(TorrentCustomField::getCheckboxOptions())
|
||||
->label(__('label.search_box.custom_fields'))
|
||||
,
|
||||
Forms\Components\TextInput::make('custom_fields_display_name')
|
||||
->label(__('label.search_box.custom_fields_display_name'))
|
||||
,
|
||||
Forms\Components\Textarea::make('custom_fields_display')
|
||||
->label(__('label.search_box.custom_fields_display'))
|
||||
->helperText(__('label.search_box.custom_fields_display_help'))
|
||||
,
|
||||
Forms\Components\Section::make(__('label.search_box.section_name'))
|
||||
->schema($sectionNameLocalSchema)
|
||||
->columns(count($sectionNameLocalSchema))
|
||||
,
|
||||
Forms\Components\Toggle::make('showsubcat')->label(__('label.search_box.showsubcat'))->columnSpan(['sm' => 'full']),
|
||||
Forms\Components\Section::make(__('label.search_box.showsubcat'))->schema([
|
||||
Forms\Components\Repeater::make('extra.' . SearchBox::EXTRA_TAXONOMY_LABELS)
|
||||
->schema([
|
||||
Forms\Components\Select::make('torrent_field')->options(SearchBox::getSubCatOptions())->label(__('label.search_box.torrent_field')),
|
||||
Forms\Components\Section::make(__('label.search_box.taxonomy_display_text'))->schema($displayTextLocalSchema)->columns(count($displayTextLocalSchema)),
|
||||
])
|
||||
->label(__('label.search_box.taxonomies'))
|
||||
->rules([
|
||||
function () {
|
||||
return function (string $attribute, $value, \Closure $fail) {
|
||||
$fields = [];
|
||||
foreach ($value as $item) {
|
||||
if (!in_array($item['torrent_field'], $fields)) {
|
||||
$fields[] = $item['torrent_field'];
|
||||
} else {
|
||||
$fail(__('label.search_box.torrent_field_duplicate', ['field' => $item['torrent_field']]));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
])
|
||||
,
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.search_box.name')),
|
||||
Tables\Columns\BooleanColumn::make('showsubcat')->label(__('label.search_box.showsubcat')),
|
||||
Tables\Columns\BooleanColumn::make('showsource'),
|
||||
Tables\Columns\BooleanColumn::make('showmedium'),
|
||||
Tables\Columns\BooleanColumn::make('showcodec'),
|
||||
Tables\Columns\BooleanColumn::make('showstandard'),
|
||||
Tables\Columns\BooleanColumn::make('showprocessing'),
|
||||
Tables\Columns\BooleanColumn::make('showteam'),
|
||||
Tables\Columns\BooleanColumn::make('showaudiocodec'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSections::route('/'),
|
||||
'create' => Pages\CreateSection::route('/create'),
|
||||
'edit' => Pages\EditSection::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\SectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SectionResource;
|
||||
use App\Models\SearchBox;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSection extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SectionResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
return SearchBox::formatTaxonomyExtra($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\SectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SectionResource;
|
||||
use App\Models\SearchBox;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSection extends EditRecord
|
||||
{
|
||||
protected static string $resource = SectionResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
return SearchBox::formatTaxonomyExtra($data);
|
||||
}
|
||||
|
||||
protected function afterSave()
|
||||
{
|
||||
clear_search_box_cache($this->record->id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\SectionResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\SectionResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSections extends PageList
|
||||
{
|
||||
protected static string $resource = SectionResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\SourceResource\Pages;
|
||||
use App\Filament\Resources\Section\SourceResource\RelationManagers;
|
||||
use App\Models\Source;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class SourceResource extends CodecResource
|
||||
{
|
||||
protected static ?string $model = Source::class;
|
||||
|
||||
protected static ?int $navigationSort = 7;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return parent::form($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return parent::table($table);
|
||||
}
|
||||
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSources::route('/'),
|
||||
'create' => Pages\CreateSource::route('/create'),
|
||||
'edit' => Pages\EditSource::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SourceResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SourceResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSource extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SourceResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SourceResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SourceResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSource extends EditRecord
|
||||
{
|
||||
protected static string $resource = SourceResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SourceResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\SourceResource;
|
||||
use App\Models\Source;
|
||||
use App\Models\Team;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListSources extends PageList
|
||||
{
|
||||
protected static string $resource = SourceResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Source::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\StandardResource\Pages;
|
||||
use App\Filament\Resources\Section\StandardResource\RelationManagers;
|
||||
use App\Models\Standard;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class StandardResource extends CodecResource
|
||||
{
|
||||
protected static ?string $model = Standard::class;
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return parent::form($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return parent::table($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListStandards::route('/'),
|
||||
'create' => Pages\CreateStandard::route('/create'),
|
||||
'edit' => Pages\EditStandard::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\StandardResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\StandardResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateStandard extends CreateRecord
|
||||
{
|
||||
protected static string $resource = StandardResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\StandardResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\StandardResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditStandard extends EditRecord
|
||||
{
|
||||
protected static string $resource = StandardResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\StandardResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\StandardResource;
|
||||
use App\Models\Codec;
|
||||
use App\Models\Standard;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListStandards extends PageList
|
||||
{
|
||||
protected static string $resource = StandardResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Standard::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\Section\TeamResource\Pages;
|
||||
use App\Filament\Resources\Section\TeamResource\RelationManagers;
|
||||
use App\Models\Team;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Tables;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class TeamResource extends CodecResource
|
||||
{
|
||||
protected static ?string $model = Team::class;
|
||||
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return parent::form($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return parent::table($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListTeams::route('/'),
|
||||
'create' => Pages\CreateTeam::route('/create'),
|
||||
'edit' => Pages\EditTeam::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\TeamResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\TeamResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateTeam extends CreateRecord
|
||||
{
|
||||
protected static string $resource = TeamResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\TeamResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\TeamResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditTeam extends EditRecord
|
||||
{
|
||||
protected static string $resource = TeamResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\TeamResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\TeamResource;
|
||||
use App\Models\Standard;
|
||||
use App\Models\Team;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListTeams extends PageList
|
||||
{
|
||||
protected static string $resource = TeamResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return Team::query()->with('search_box')->orderBy('mode', 'asc');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user