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:
ak
2026-08-12 01:15:38 +08:00
commit 263b98b218
337 changed files with 31393 additions and 0 deletions
@@ -0,0 +1,71 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Comments;
use App\Filament\Resources\Comments\Pages\CreateComment;
use App\Filament\Resources\Comments\Pages\EditComment;
use App\Filament\Resources\Comments\Pages\ListComments;
use App\Filament\Resources\Comments\Schemas\CommentForm;
use App\Filament\Resources\Comments\Tables\CommentsTable;
use App\Models\Comment;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use App\Filament\Concerns\HasTranslatedLabels;
class CommentResource extends Resource
{
use HasTranslatedLabels;
protected static ?string $model = Comment::class;
protected static function navKey(): string
{
return 'comments';
}
protected static function modelKey(): string
{
return 'comment';
}
protected static function groupKey(): string
{
return 'content';
}
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
public static function form(Schema $schema): Schema
{
return CommentForm::configure($schema);
}
public static function table(Table $table): Table
{
return CommentsTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListComments::route('/'),
'create' => CreateComment::route('/create'),
'edit' => EditComment::route('/{record}/edit'),
];
}
}
@@ -0,0 +1,13 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Comments\Pages;
use App\Filament\Resources\Comments\CommentResource;
use Filament\Resources\Pages\CreateRecord;
class CreateComment extends CreateRecord
{
protected static string $resource = CommentResource::class;
}
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Comments\Pages;
use App\Filament\Resources\Comments\CommentResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditComment extends EditRecord
{
protected static string $resource = CommentResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Comments\Pages;
use App\Filament\Resources\Comments\CommentResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListComments extends ListRecords
{
protected static string $resource = CommentResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}
@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Comments\Schemas;
use App\Models\Comment;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Schemas\Schema;
class CommentForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Select::make('article_id')
->label(__('admin.fields.article'))
->relationship('article', 'title')
->required(),
TextInput::make('author')
->label(__('admin.fields.author'))
->required(),
TextInput::make('url')
->label(__('admin.fields.url'))
->url(),
Textarea::make('content')
->label(__('admin.fields.content'))
->required()
->columnSpanFull(),
TextInput::make('ip')
->label(__('admin.fields.ip')),
Select::make('moderation_status')
->label(__('admin.fields.moderation_status'))
->options([
Comment::STATUS_PENDING => __('admin.options.moderation.pending'),
Comment::STATUS_PENDING_AI => __('admin.options.moderation.pending_ai'),
Comment::STATUS_APPROVED => __('admin.options.moderation.approved'),
Comment::STATUS_REJECTED => __('admin.options.moderation.rejected'),
Comment::STATUS_NEEDS_HUMAN => __('admin.options.moderation.needs_human'),
])
->required()
->default(Comment::STATUS_PENDING),
DateTimePicker::make('published_at')
->label(__('admin.fields.published_at')),
]);
}
}
@@ -0,0 +1,61 @@
<?php
declare(strict_types=1);
namespace App\Filament\Resources\Comments\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class CommentsTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('article.title')
->label(__('admin.fields.article'))
->searchable(),
TextColumn::make('author')
->label(__('admin.fields.author'))
->searchable(),
TextColumn::make('url')
->label(__('admin.fields.url'))
->searchable(),
TextColumn::make('ip')
->label(__('admin.fields.ip'))
->searchable(),
TextColumn::make('moderation_status')
->label(__('admin.fields.moderation_status'))
->searchable(),
TextColumn::make('published_at')
->label(__('admin.fields.published_at'))
->dateTime()
->sortable(),
TextColumn::make('created_at')
->label(__('admin.fields.created_at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('updated_at')
->label(__('admin.fields.updated_at'))
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->recordActions([
EditAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}