mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
add global promotion deadline + fix grane medal
This commit is contained in:
@@ -17,7 +17,7 @@ class CreateExam extends CreateRecord
|
||||
// dd($data);
|
||||
$examRep = new ExamRepository();
|
||||
try {
|
||||
$examRep->store($data);
|
||||
$this->record = $examRep->store($data);
|
||||
$this->notify('success', $this->getCreatedNotificationMessage());
|
||||
if ($another) {
|
||||
// Ensure that the form record is anonymized so that relationships aren't loaded.
|
||||
|
||||
@@ -23,7 +23,7 @@ class EditExam extends EditRecord
|
||||
$data = $this->form->getState();
|
||||
$examRep = new ExamRepository();
|
||||
try {
|
||||
$examRep->update($data, $this->record->id);
|
||||
$this->record = $examRep->update($data, $this->record->id);
|
||||
$this->notify('success', $this->getSavedNotificationMessage());
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
|
||||
@@ -9,4 +9,9 @@ use Filament\Resources\Pages\CreateRecord;
|
||||
class CreateMedal extends CreateRecord
|
||||
{
|
||||
protected static string $resource = MedalResource::class;
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
return $this->getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
|
||||
81
app/Filament/Resources/System/TorrentStateResource.php
Normal file
81
app/Filament/Resources/System/TorrentStateResource.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use App\Filament\Resources\System\TorrentStateResource\Pages;
|
||||
use App\Filament\Resources\System\TorrentStateResource\RelationManagers;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentState;
|
||||
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;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class TorrentStateResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TorrentState::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-speakerphone';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 99;
|
||||
|
||||
protected static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.torrent_state');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('global_sp_state')
|
||||
->options(Torrent::listPromotionTypes(true))
|
||||
->label(__('label.torrent_state.global_sp_state'))
|
||||
->required(),
|
||||
Forms\Components\DateTimePicker::make('deadline')
|
||||
->required()
|
||||
->label(__('label.deadline')),
|
||||
])->columns(1);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('global_sp_state_text')->label(__('label.torrent_state.global_sp_state')),
|
||||
Tables\Columns\TextColumn::make('deadline')->label(__('label.deadline')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make()->after(function () {
|
||||
do_log("cache_del: global_promotion_state");
|
||||
NexusDB::cache_del('global_promotion_state');
|
||||
NexusDB::cache_del('global_promotion_state_deadline');
|
||||
}),
|
||||
// Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageTorrentStates::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\System\TorrentStateResource\Pages;
|
||||
|
||||
use App\Filament\Resources\System\TorrentStateResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class ManageTorrentStates extends ManageRecords
|
||||
{
|
||||
protected static string $resource = TorrentStateResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
// Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function isTablePaginationEnabled(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user