Aloia — 基于 Laravel 9 的扁平化风格 CMS
Aloia CMS 是laravel的扁平件内容管理系统。您无需重建整个应用程序即可提供CMS功能,并且可以在现有应用程序中引用Aloia。
Aloia提供以下内容类型的开箱即用,您可以在Markdown或HTML中作为平面文件管理。
- Page
- Article
- ContentBlock
- MetaTag
让我们以文章内容类型为例,并说明您如何与这些平面模型进行交互:
use AloiaCms\Models\Article;
use Illuminate\Support\Collection;
// Get a collection of Article[]|Collection
$articles = Article::all();
// Find an article
$article = Article::find('this-post-is-amazing');
以及更新文章的更高级示例,然后以选择的格式更新平面文件:
use Carbon\Carbon;
Article::find('this-post-is-amazing')
// md is the default, but you can use html as well.
->setExtension('md')
->setMatter([
'description' => 'This post is about beautiful things',
'is_published' => true,
'is_sechduled' => false,
// Either use post_date in setMatter() or setPostDate()
'post_date' => date('Y-m-d')
])
->setPostDate(Carbon::now())
->setBody('# This is the content of an article')
->save();
ContentBlock 是另一种有趣的内容类型,因为它允许您创建部分内容块并将其渲染到 blade 文件中。例如,给定 MARKDOWN 中的以下内容块:
## Title of the content
This is a paragraph
该内容块可以通过一个 Balde 文件进行编辑和渲染:
{!! Block::get('test') !!}
渲染结果:
<h2>Title of the content</h2>
<p>This is a paragraph</p>
你还可以创建 custom content types,并像其他任何内置内容类型一样与它们进行交互。
更多
查看ALOIA CMS文档以安装此软件包并学习如何使用它。您可以了解有关此软件包的更多信息,获取完整的安装说明,然后在GitHub上查看源代码。
本文中的所有译文仅用于学习和交流目的,转载请务必注明文章译者、出处、和本文链接
我们的翻译工作遵照 CC 协议,如果我们的工作有侵犯到您的权益,请及时联系我们。