lamine860/filament-blog

纤维博客构建器

资助包维护!
stephenjude

v1.0.5 2023-12-08 11:12 UTC

This package is not auto-updated.

Last update: 2024-09-25 02:18:25 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

一个无脸博客内容管理器,支持可配置的富文本和 Markdown,适用于纤维管理员面板。

纤维管理员面板

此包针对 纤维管理员面板 定制。

在继续安装之前,请确保您已安装管理员面板。您可以在此处查看文档

支持的版本

PHP: 8.1 & 8.2

Laravel: 10

安装

您可以通过 composer 安装此包

composer require lamine860/filament-blog

php artisan filament-blog:install

php artisan storage:link

php artisan migrate

您需要在其面板提供者中注册插件。

public function panel(Panel $panel): Panel
{
    return $panel
        ...
        ->plugin(
            Stephenjude\FilamentBlog\BlogPlugin::make()
        );
}

显示内容

纤维博客构建器是无脸的,它对您在前端如何显示内容没有意见。您可以使用控制器中的博客模型来显示不同的资源

  • Stephenjude\FilamentBlog\Models\Post
  • Stephenjude\FilamentBlog\Models\Author
  • Stephenjude\FilamentBlog\Models\Category

帖子 & 草稿

$posts = Post::published()->get();

$drafts = Post::draft()->get();

帖子内容

$post = Post::find($id);

$post->id;
$post->title;
$post->slug;
$post->excerpt;
$post->banner_url;
$post->content;
$post->published_at;

帖子类别 & 作者

$post = Post::with(['author', 'category'])->find($id);

$author = $post->author;

$author->id;
$author->name;
$author->email;
$author->photo;
$author->bio;
$author->github_handle;
$author->twitter_handle;


$category = $post->category;

$category->id;
$category->name;
$category->slug;
$category->description;
$category->is_visible;
$category->seo_title;
$category->seo_description;

配置

这是发布配置文件的内容

<?php

return [

    /**
     * Supported content editors: richtext & markdown:
     *      \Filament\Forms\Components\RichEditor::class
     *      \Filament\Forms\Components\MarkdownEditor::class
     */
    'editor'  => \Filament\Forms\Components\RichEditor::class,

    /**
     * Buttons for text editor toolbar.
     */
    'toolbar_buttons' => [
        'attachFiles',
        'blockquote',
        'bold',
        'bulletList',
        'codeBlock',
        'h2',
        'h3',
        'italic',
        'link',
        'orderedList',
        'redo',
        'strike',
        'undo',
    ],

    /**
     * Configs for Posts that give you the option to change
     * the sort column and direction of the Posts.
     */
    'sort' => [
        'column' => 'published_at',
        'direction' => 'asc',
    ],
];

更多截图

测试

composer test

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全漏洞

请审查 我们的安全策略 了解如何报告安全漏洞。

鸣谢

许可

MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。