2026-01-08 16:22:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Filament\Resources\TextWidgets\Schemas;
|
|
|
|
|
|
2026-01-09 13:18:37 +00:00
|
|
|
use App\Models\Category;
|
|
|
|
|
use Filament\Forms\Components\Select;
|
2026-01-08 16:22:47 +00:00
|
|
|
use Filament\Forms\Components\Textarea;
|
|
|
|
|
use Filament\Forms\Components\TextInput;
|
|
|
|
|
use Filament\Schemas\Schema;
|
|
|
|
|
|
|
|
|
|
class TextWidgetForm
|
|
|
|
|
{
|
|
|
|
|
public static function configure(Schema $schema): Schema
|
|
|
|
|
{
|
|
|
|
|
return $schema
|
|
|
|
|
->components([
|
|
|
|
|
TextInput::make('title')
|
|
|
|
|
->required()
|
|
|
|
|
->live(onBlur: true),
|
|
|
|
|
TextInput::make('description')
|
|
|
|
|
->nullable(),
|
|
|
|
|
Textarea::make('content')
|
|
|
|
|
->rows(5)
|
|
|
|
|
->columnSpanFull(),
|
2026-01-09 13:18:37 +00:00
|
|
|
Select::make('category_id')
|
|
|
|
|
->label('Category')
|
|
|
|
|
->options(function () {
|
|
|
|
|
return Category::all()
|
|
|
|
|
->pluck('name', 'id')
|
|
|
|
|
->toArray();
|
|
|
|
|
})
|
|
|
|
|
->searchable(),
|
2026-01-08 16:22:47 +00:00
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|