Initial baseline: LaraBlog core with plugin commerce surface.
Captures the current working tree after theme slots, ArticleAccess, and the payment / paid-content plugins so subsequent work has a reviewable git history.
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\Articles\Schemas;
|
||||
|
||||
use App\Domain\Blog\ContentFormat;
|
||||
use App\Domain\Plugin\Hook;
|
||||
use App\Settings\GeneralSettings;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class ArticleForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
$defaultFormat = ContentFormat::MARKDOWN;
|
||||
try {
|
||||
$defaultFormat = ContentFormat::normalize(app(GeneralSettings::class)->default_content_format, ContentFormat::MARKDOWN);
|
||||
} catch (\Throwable) {
|
||||
//
|
||||
}
|
||||
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('category_id')
|
||||
->label(__('admin.fields.category'))
|
||||
->relationship('category', 'name')
|
||||
->required(),
|
||||
Select::make('user_id')
|
||||
->label(__('admin.fields.author'))
|
||||
->relationship('user', 'name')
|
||||
->required(),
|
||||
TextInput::make('title')
|
||||
->label(__('admin.fields.title'))
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
Select::make('content_format')
|
||||
->label(__('admin.fields.content_format'))
|
||||
->options([
|
||||
ContentFormat::MARKDOWN => __('admin.options.markdown_recommended'),
|
||||
ContentFormat::HTML => __('admin.options.html_legacy'),
|
||||
])
|
||||
->default($defaultFormat)
|
||||
->required()
|
||||
->live()
|
||||
->helperText(__('admin.helpers.article_content')),
|
||||
Textarea::make('content')
|
||||
->label(fn (Get $get): string => $get('content_format') === ContentFormat::MARKDOWN
|
||||
? __('admin.fields.content_markdown')
|
||||
: __('admin.fields.content_html'))
|
||||
->required()
|
||||
->rows(18)
|
||||
->columnSpanFull(),
|
||||
TextInput::make('description')
|
||||
->label(__('admin.fields.description')),
|
||||
TextInput::make('keywords')
|
||||
->label(__('admin.fields.keywords')),
|
||||
TextInput::make('slug')
|
||||
->label(__('admin.fields.slug')),
|
||||
DateTimePicker::make('published_at')
|
||||
->label(__('admin.fields.published_at'))
|
||||
->default(now()),
|
||||
Toggle::make('stick')
|
||||
->label(__('admin.fields.stick'))
|
||||
->default(false),
|
||||
Toggle::make('visible')
|
||||
->label(__('admin.fields.visible'))
|
||||
->default(true),
|
||||
Toggle::make('close_comment')
|
||||
->label(__('admin.fields.close_comment'))
|
||||
->default(false),
|
||||
TextInput::make('read_password')
|
||||
->label(__('admin.fields.read_password'))
|
||||
->password(),
|
||||
Textarea::make('ai_summary')
|
||||
->label(__('admin.fields.ai_summary'))
|
||||
->columnSpanFull(),
|
||||
...Hook::collect('filament.article.form'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user