mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-25 04:27:22 +08:00
tag add mode
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Section;
|
||||
|
||||
use App\Filament\Resources\System\SectionResource\Pages;
|
||||
use App\Filament\Resources\System\SectionResource\RelationManagers;
|
||||
use App\Filament\Resources\Section\SectionResource\Pages;
|
||||
use App\Filament\Resources\Section\SectionResource\RelationManagers;
|
||||
use App\Http\Middleware\Locale;
|
||||
use App\Models\Forum;
|
||||
use App\Models\SearchBox;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\SectionResource\Pages;
|
||||
namespace App\Filament\Resources\Section\SectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SectionResource;
|
||||
use App\Models\SearchBox;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\SectionResource\Pages;
|
||||
namespace App\Filament\Resources\Section\SectionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SectionResource;
|
||||
use App\Models\SearchBox;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\SectionResource\Pages;
|
||||
namespace App\Filament\Resources\Section\SectionResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\SectionResource;
|
||||
|
||||
@@ -17,7 +17,7 @@ class CreateExam extends CreateRecord
|
||||
$examRep = new ExamRepository();
|
||||
try {
|
||||
$this->record = $examRep->store($data);
|
||||
$this->notify('success', $this->getCreatedNotificationMessage());
|
||||
$this->notify('success', $this->getCreatedNotificationTitle());
|
||||
if ($another) {
|
||||
// Ensure that the form record is anonymized so that relationships aren't loaded.
|
||||
$this->form->model($this->record::class);
|
||||
|
||||
@@ -22,7 +22,7 @@ class CreateSeedBoxRecord extends CreateRecord
|
||||
$rep = new SeedBoxRepository();
|
||||
try {
|
||||
$this->record = $rep->store($data);
|
||||
$this->notify('success', $this->getCreatedNotificationMessage());
|
||||
$this->notify('success', $this->getCreatedNotificationTitle());
|
||||
if ($another) {
|
||||
// Ensure that the form record is anonymized so that relationships aren't loaded.
|
||||
$this->form->model($this->record::class);
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Filament\Resources\Torrent;
|
||||
|
||||
use App\Filament\Resources\Torrent\TagResource\Pages;
|
||||
use App\Filament\Resources\Torrent\TagResource\RelationManagers;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\Tag;
|
||||
use Filament\Forms;
|
||||
use Filament\Resources\Form;
|
||||
@@ -45,6 +46,11 @@ class TagResource extends Resource
|
||||
Forms\Components\TextInput::make('padding')->required()->label(__('label.tag.padding')),
|
||||
Forms\Components\TextInput::make('border_radius')->required()->label(__('label.tag.border_radius')),
|
||||
Forms\Components\TextInput::make('priority')->integer()->required()->label(__('label.priority'))->default(0),
|
||||
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'))
|
||||
,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -53,6 +59,10 @@ class TagResource extends Resource
|
||||
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.name'))->searchable(),
|
||||
Tables\Columns\TextColumn::make('color')->label(__('label.tag.color')),
|
||||
Tables\Columns\TextColumn::make('font_color')->label(__('label.tag.font_color')),
|
||||
@@ -66,7 +76,17 @@ class TagResource extends Resource
|
||||
])
|
||||
->defaultSort('priority', 'desc')
|
||||
->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->when($data['value'], function (Builder $query, $value) {
|
||||
return $query->where(function (Builder $query) use ($value) {
|
||||
return $query->where('mode', $value)->orWhere('mode', 0);
|
||||
});
|
||||
});
|
||||
})
|
||||
,
|
||||
])
|
||||
->actions(self::getActions())
|
||||
->bulkActions([
|
||||
|
||||
@@ -20,7 +20,7 @@ class CreateUser extends CreateRecord
|
||||
$this->record = $userRep->store($data);
|
||||
$this->notify(
|
||||
'success ',
|
||||
$this->getCreatedNotificationMessage(),
|
||||
$this->getCreatedNotificationTitle(),
|
||||
);
|
||||
$this->redirect($this->getRedirectUrl());
|
||||
} catch (\Exception $exception) {
|
||||
|
||||
Reference in New Issue
Block a user