stephenjude/filament-blog

Filament Blog Builder

3.0.0 2024-03-04 20:07 UTC

This package is auto-updated.

Last update: 2024-09-03 13:58:50 UTC


README

Filament Blog Builder

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

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

Filament Admin Panel

本包专为Filament Admin Panel定制。

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

支持的版本

PHP: 8.1 & 8.2

Laravel: 10

安装

您可以通过composer安装此包

composer require stephenjude/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()
        );
}

显示内容

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

  • 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)。有关更多信息,请参阅许可证文件