mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\Actions\Discord;
|
|
|
|
use App\Actions\Discord\DiscordThreadAction as DiscordThreadActionAction;
|
|
use App\Models\Wiki\Anime;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Tables\Actions\Action;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class DiscordThreadAction.
|
|
*/
|
|
class DiscordThreadAction extends Action
|
|
{
|
|
/**
|
|
* Initial setup for the action.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->fillForm(fn (Anime $record): array => ['name' => $record->getName()]);
|
|
|
|
$this->action(fn (Anime $record, array $data) => (new DiscordThreadActionAction())->handle($record, $data));
|
|
}
|
|
|
|
/**
|
|
* Get the fields available on the action.
|
|
*
|
|
* @param Form $form
|
|
* @return Form
|
|
*/
|
|
public function getForm(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
TextInput::make('name')
|
|
->label(__('filament.actions.discord.thread.name'))
|
|
->helperText(__('filament.actions.discord.thread.help'))
|
|
->required()
|
|
->maxlength(100)
|
|
->rules(['required', 'max:100']),
|
|
]);
|
|
}
|
|
}
|