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
+69
View File
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace App\Models;
use App\Domain\Plugin\Hook;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Comment extends Model
{
public const STATUS_PENDING = 'pending';
public const STATUS_PENDING_AI = 'pending_ai';
public const STATUS_APPROVED = 'approved';
public const STATUS_REJECTED = 'rejected';
public const STATUS_NEEDS_HUMAN = 'needs_human';
protected $fillable = [
'article_id',
'author',
'url',
'content',
'ip',
'moderation_status',
'published_at',
];
protected function casts(): array
{
return [
'published_at' => 'datetime',
];
}
protected static function booted(): void
{
static::created(function (Comment $comment): void {
Hook::dispatch('comment.created', $comment);
});
}
public function article(): BelongsTo
{
return $this->belongsTo(Article::class);
}
public function scopeApproved(Builder $query): Builder
{
return $query->where('moderation_status', self::STATUS_APPROVED);
}
public function scopeVisible(Builder $query): Builder
{
return $query->approved()
->whereNotNull('published_at')
->where('published_at', '<=', now());
}
public function isApproved(): bool
{
return $this->moderation_status === self::STATUS_APPROVED;
}
}