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
View File
+101
View File
@@ -0,0 +1,101 @@
@extends('theme::layout')
@php
$rendered = $article->rendered();
$bodyHtml = $rendered['html'];
$toc = $rendered['toc'];
@endphp
@section('content')
@themeslot('article_top')
<article class="post" itemscope itemtype="https://schema.org/BlogPosting">
<header class="post__header">
<h1 class="post__title" itemprop="headline">{{ $article->title }}</h1>
<p class="post__meta">
@if($article->published_at)
<time datetime="{{ $article->published_at->toIso8601String() }}" itemprop="datePublished">
{{ $article->published_at->format('Y-m-d H:i') }}
</time>
@endif
@if($article->category)
<span aria-hidden="true"> · </span>
<a class="post__category" href="{{ url('/category-'.$article->category->id.'.shtml') }}" rel="category tag">
{{ $article->category->name }}
</a>
@endif
@if($article->user)
<span aria-hidden="true"> · </span>
<span itemprop="author" itemscope itemtype="https://schema.org/Person">
<span itemprop="name">{{ $article->user->name ?: $article->user->username }}</span>
</span>
@endif
<span aria-hidden="true"> · </span>
<span>{{ $article->views }} {{ __('frontend.common.reads') }}</span>
</p>
</header>
@if(count($toc) >= 2)
<nav class="post__toc" aria-labelledby="post-toc-heading">
<h2 id="post-toc-heading" class="post__toc-title">{{ __('frontend.article.toc') }}</h2>
<ol class="post__toc-list">
@foreach($toc as $item)
<li class="post__toc-item post__toc-item--h{{ $item['level'] }}">
<a href="#{{ $item['id'] }}">{{ $item['text'] }}</a>
</li>
@endforeach
</ol>
</nav>
@endif
<div class="post__content entry-content" itemprop="articleBody">
{!! $bodyHtml !!}
</div>
@if($article->tags->isNotEmpty())
<footer class="post__footer">
<ul class="post__tags">
@foreach($article->tags as $tag)
<li>
<a class="chip" rel="tag" href="{{ url('/tag/'.rawurlencode($tag->name)) }}">{{ $tag->name }}</a>
</li>
@endforeach
</ul>
</footer>
@endif
</article>
@themeslot('article_bottom')
<section class="comments panel" aria-labelledby="comments-heading">
<h2 id="comments-heading" class="comments__title">{{ __('frontend.common.comments') }}</h2>
@forelse($article->comments as $comment)
<article class="comment">
<header class="comment__meta">
<strong class="comment__author">{{ $comment->author }}</strong>
@if($comment->published_at)
<time datetime="{{ $comment->published_at->toIso8601String() }}">
{{ $comment->published_at->format('Y-m-d H:i') }}
</time>
@endif
</header>
<div class="comment__body">{!! $comment->content !!}</div>
</article>
@empty
<p class="meta">{{ __('frontend.common.no_comments') }}</p>
@endforelse
@if(!$article->close_comment)
<form class="stack comments__form" method="post" action="{{ url('/post.php') }}">
@csrf
<input type="hidden" name="action" value="addcomment">
<input type="hidden" name="article_id" value="{{ $article->id }}">
<label for="comment-author">{{ __('frontend.common.nickname') }}</label>
<input id="comment-author" name="author" required maxlength="50" value="{{ old('author', auth()->user()?->username) }}">
<label for="comment-url">{{ __('frontend.common.website') }}</label>
<input id="comment-url" name="url" type="url" value="{{ old('url', auth()->user()?->url) }}">
<label for="comment-content">{{ __('frontend.common.content') }}</label>
<textarea id="comment-content" name="content" rows="5" required>{{ old('content') }}</textarea>
<button type="submit">{{ __('frontend.common.submit_comment') }}</button>
</form>
@endif
</section>
@endsection
+17
View File
@@ -0,0 +1,17 @@
@extends('theme::layout')
@section('content')
<div class="panel"><h1 class="page-title">最新评论</h1></div>
<div class="panel">
@forelse($comments as $comment)
<div class="comment">
<strong>{{ $comment->author }}</strong>
<span class="meta"> · <a href="{{ url('/show-'.$comment->article_id.'.shtml') }}">{{ $comment->article?->title }}</a></span>
<div>{!! $comment->content !!}</div>
</div>
@empty
<p class="meta">暂无评论</p>
@endforelse
</div>
<div class="pagination">{{ $comments->links() }}</div>
@endsection
+24
View File
@@ -0,0 +1,24 @@
@extends('theme::layout')
@section('content')
<div class="post-list">
@forelse($articles as $article)
<article class="post-item">
<h2><a href="{{ url('/show-'.$article->id.'.shtml') }}">{{ $article->title }}</a></h2>
<p class="meta">
{{ optional($article->published_at)->format('Y-m-d') }}
@if($article->category) · {{ $article->category->name }} @endif
· {{ strtoupper($article->content_format) }}
@if($article->stick) · 置顶 @endif
</p>
<p class="excerpt">{{ app(\App\Domain\Blog\ArticleExcerpt::class)->forList($article) }}</p>
</article>
@empty
<div class="panel">
<h1 class="page-title">还没有文章</h1>
<p class="meta">去后台发布第一篇,或运行 <code>php artisan db:seed</code> 载入演示内容。</p>
</div>
@endforelse
</div>
<div class="pagination">{{ $articles->links() }}</div>
@endsection
+113
View File
@@ -0,0 +1,113 @@
@php
$themeManager = app(\App\Domain\Theme\ThemeManager::class);
$activeTheme = $themeManager->active();
$stylevars = \App\Models\Stylevar::query()->visible()->orderBy('id')->get();
@endphp
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>{{ $seo['title'] ?? ($settings->site_name ?? config('app.name')) }}</title>
@if(!empty($seo['canonical']))
<link rel="canonical" href="{{ $seo['canonical'] }}">
@endif
@if(!empty($seo['description']))
<meta name="description" content="{{ $seo['description'] }}">
@endif
@if(!empty($seo['keywords']))
<meta name="keywords" content="{{ $seo['keywords'] }}">
@endif
@foreach(($seo['og'] ?? []) as $property => $content)
<meta property="{{ $property }}" content="{{ $content }}">
@endforeach
@foreach(($seo['twitter'] ?? []) as $name => $content)
<meta name="{{ $name }}" content="{{ $content }}">
@endforeach
@if(!empty($seo['jsonld']))
<script type="application/ld+json">{!! json_encode($seo['jsonld'], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES) !!}</script>
@endif
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ url('/rss.xml') }}">
<link rel="stylesheet" href="{{ $themeManager->assetUrl('style.css') }}?v={{ @filemtime(base_path('themes/'.$activeTheme.'/assets/style.css')) }}">
@stack('head')
@themeslot('head')
</head>
<body data-theme="{{ $activeTheme }}">
@themeslot('body_start')
<header class="site-header">
<div class="wrap">
<div class="brand-block">
<a class="brand" href="{{ url('/') }}">{{ $settings->site_name ?? 'Lara' }}<span>Blog</span></a>
<p class="tagline">{{ $settings->site_description ?: '写作、归档与发现——现代博客引擎' }}</p>
</div>
<nav class="nav-bar" aria-label="{{ __('frontend.nav.home') }}">
<a href="{{ url('/') }}">{{ __('frontend.nav.home') }}</a>
<a href="{{ url('/archives.shtml') }}">{{ __('frontend.nav.archives') }}</a>
<a href="{{ url('/tagslist.shtml') }}">{{ __('frontend.nav.tags') }}</a>
<a href="{{ url('/comments.shtml') }}">{{ __('frontend.nav.comments') }}</a>
<a href="{{ url('/links.shtml') }}">{{ __('frontend.nav.links') }}</a>
<a href="{{ url('/search.shtml') }}">{{ __('frontend.nav.search') }}</a>
@auth
<a href="{{ url('/index.php?action=profile') }}">{{ __('frontend.nav.profile') }}</a>
@else
<a href="{{ url('/login.shtml') }}">{{ __('frontend.nav.login') }}</a>
<a href="{{ url('/reg.shtml') }}">{{ __('frontend.nav.register') }}</a>
@endauth
</nav>
@themeslot('nav_after')
@if(session('status'))
<p class="flash">{{ session('status') }}</p>
@endif
</div>
</header>
@themeslot('header_after')
<main class="wrap layout">
<section class="content">
@themeslot('content_before')
@yield('content')
@themeslot('content_after')
</section>
<aside class="sidebar">
@themeslot('sidebar_before')
<div class="panel">
<h3>{{ __('frontend.sidebar.categories') }}</h3>
<ul>
@forelse(($categories ?? []) as $category)
<li><a href="{{ url('/category-'.$category->id.'.shtml') }}">{{ $category->name }}</a></li>
@empty
<li class="note">{{ __('frontend.sidebar.empty_category') }}</li>
@endforelse
</ul>
</div>
@foreach($stylevars as $stylevar)
<div class="panel">
<h3>{{ $stylevar->title }}</h3>
<p class="note">{!! nl2br(e($stylevar->value)) !!}</p>
</div>
@endforeach
@php($sidebarInject = trim(\App\Domain\Theme\ThemeSlot::render('sidebar')))
@if($sidebarInject !== '')
<div class="panel theme-slot-sidebar">
{!! $sidebarInject !!}
</div>
@endif
@php($sidebarAfter = trim(\App\Domain\Theme\ThemeSlot::render('sidebar_after')))
@if($sidebarAfter !== '')
<div class="panel theme-slot-sidebar-after">
{!! $sidebarAfter !!}
</div>
@endif
<div class="panel">
<h3>{{ __('frontend.sidebar.subscribe') }}</h3>
<p class="note"><a href="{{ url('/rss.xml') }}">RSS</a> · <a href="{{ url('/sitemap.xml') }}">Sitemap</a> · <a href="{{ url('/llms.txt') }}">llms.txt</a></p>
</div>
</aside>
</main>
@themeslot('footer_before')
<footer class="site-footer wrap">
<p>&copy; {{ date('Y') }} {{ $settings->site_name ?? 'LaraBlog' }} · {{ __('frontend.common.theme') }} {{ $activeTheme }}</p>
</footer>
@themeslot('footer_after')
@themeslot('body_end')
</body>
</html>
+14
View File
@@ -0,0 +1,14 @@
@extends('theme::layout')
@section('content')
<div class="panel">
<h1 class="page-title">友情链接</h1>
<ul>
@forelse($links as $link)
<li><a href="{{ $link->url }}" rel="noopener" target="_blank">{{ $link->name }}</a>@if($link->note) {{ $link->note }}@endif</li>
@empty
<li class="meta">暂无链接</li>
@endforelse
</ul>
</div>
@endsection
+21
View File
@@ -0,0 +1,21 @@
@extends('theme::layout')
@section('content')
<div class="panel article-body">
<h1 class="page-title">登录</h1>
@if ($errors->any())
<p class="flash">{{ $errors->first() }}</p>
@endif
<form class="stack" method="post" action="{{ url('/post.php') }}">
@csrf
<input type="hidden" name="action" value="dologin">
<label>用户名或邮箱</label>
<input name="login" value="{{ old('login') }}" required autocomplete="username">
<label>密码</label>
<input type="password" name="password" required autocomplete="current-password">
<label><input type="checkbox" name="remember" value="1"> 记住我</label>
<button type="submit">登录</button>
</form>
<p class="meta">没有账号?<a href="{{ url('/reg.shtml') }}">注册</a></p>
</div>
@endsection
+17
View File
@@ -0,0 +1,17 @@
@extends('theme::layout')
@section('content')
<div class="panel article-body">
<h1 class="page-title">{{ $article->title }}</h1>
<p class="meta">{{ __('frontend.common.password_protected') }}</p>
@if(!empty($error))
<p class="flash">{{ $error }}</p>
@endif
<form class="stack" method="post" action="{{ url('/show-'.$article->id.'.shtml') }}">
@csrf
<label for="article-password">{{ __('frontend.common.password') }}</label>
<input id="article-password" type="password" name="password" required>
<button type="submit">{{ __('frontend.common.unlock') }}</button>
</form>
</div>
@endsection
+32
View File
@@ -0,0 +1,32 @@
@extends('theme::layout')
@section('content')
@themeslot('article_top')
<article class="post post--paywall">
<header class="post__header">
<h1 class="post__title">{{ $article->title }}</h1>
<p class="post__meta">
@if($article->published_at)
<time datetime="{{ $article->published_at->toIso8601String() }}">
{{ $article->published_at->format('Y-m-d H:i') }}
</time>
@endif
</p>
</header>
<div class="post__content entry-content">
{!! $bodyHtml !!}
</div>
<aside class="post__paywall panel" role="region" aria-label="{{ __('frontend.article.paywall_title') }}">
<h2 class="post__paywall-title">{{ __('frontend.article.paywall_title') }}</h2>
<p class="note">{{ $access->message ?: __('frontend.article.paywall_hint') }}</p>
@if($access->checkoutUrl)
<p>
<a class="button" href="{{ $access->checkoutUrl }}">{{ __('frontend.article.buy') }}</a>
</p>
@endif
</aside>
</article>
@themeslot('article_bottom')
@endsection
+33
View File
@@ -0,0 +1,33 @@
@extends('theme::layout')
@section('content')
<div class="panel article-body">
<h1 class="page-title">个人资料</h1>
@if ($errors->any())
<ul class="flash">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@endif
<p class="meta">用户名:{{ $user->username ?: $user->name }}</p>
<form class="stack" method="post" action="{{ url('/post.php') }}">
@csrf
<input type="hidden" name="action" value="modpro">
<label>邮箱</label>
<input type="email" name="email" value="{{ old('email', $user->email) }}">
<label>网站</label>
<input type="url" name="url" value="{{ old('url', $user->url) }}">
<label>新密码(留空不改)</label>
<input type="password" name="password">
<label>确认新密码</label>
<input type="password" name="password_confirmation">
<button type="submit">保存</button>
</form>
<form class="stack" method="post" action="{{ url('/post.php') }}">
@csrf
<input type="hidden" name="action" value="logout">
<button type="submit">退出登录</button>
</form>
</div>
@endsection
+30
View File
@@ -0,0 +1,30 @@
@extends('theme::layout')
@section('content')
<div class="panel article-body">
<h1 class="page-title">注册</h1>
@if ($errors->any())
<ul class="flash">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
@endif
<form class="stack" method="post" action="{{ url('/post.php') }}">
@csrf
<input type="hidden" name="action" value="register">
<label>用户名</label>
<input name="username" value="{{ old('username') }}" required>
<label>邮箱(可选)</label>
<input type="email" name="email" value="{{ old('email') }}">
<label>网站(可选)</label>
<input type="url" name="url" value="{{ old('url') }}">
<label>密码</label>
<input type="password" name="password" required>
<label>确认密码</label>
<input type="password" name="password_confirmation" required>
<button type="submit">注册</button>
</form>
<p class="meta">已有账号?<a href="{{ url('/login.shtml') }}">登录</a></p>
</div>
@endsection
+21
View File
@@ -0,0 +1,21 @@
@extends('theme::layout')
@section('content')
<div class="panel">
<h1 class="page-title">搜索</h1>
<form class="stack" method="get" action="{{ url('/search.shtml') }}">
<label>关键词</label>
<input name="keywords" value="{{ $keywords }}" placeholder="标题或正文">
<button type="submit">搜索</button>
</form>
</div>
<div class="post-list">
@foreach($articles as $article)
<article class="post-item">
<h2><a href="{{ url('/show-'.$article->id.'.shtml') }}">{{ $article->title }}</a></h2>
<p class="meta">{{ optional($article->published_at)->format('Y-m-d') }}</p>
</article>
@endforeach
</div>
<div class="pagination">{{ $articles->links() }}</div>
@endsection
+13
View File
@@ -0,0 +1,13 @@
@extends('theme::layout')
@section('content')
<div class="panel"><h1 class="page-title">标签:{{ $tag->name }}</h1></div>
<div class="post-list">
@foreach($articles as $article)
<article class="post-item">
<h2><a href="{{ url('/show-'.$article->id.'.shtml') }}">{{ $article->title }}</a></h2>
</article>
@endforeach
</div>
<div class="pagination">{{ $articles->links() }}</div>
@endsection
+13
View File
@@ -0,0 +1,13 @@
@extends('theme::layout')
@section('content')
<div class="panel">
<h1 class="page-title">标签</h1>
<p class="tag-cloud">
@foreach($tags as $tag)
<a class="chip" href="{{ url('/tag/'.rawurlencode($tag->name)) }}">{{ $tag->name }} ({{ $tag->use_count }})</a>
@endforeach
</p>
</div>
<div class="pagination">{{ $tags->links() }}</div>
@endsection