murdercode/laravel-admin-bar

Laravel 管理栏

v1.0.5 2024-03-18 13:57 UTC

README

Latest Version on Packagist run-tests Fix PHP code style issues Total Downloads

这是一个简单但强大的包,可以用于在您的下一个优秀的 Laravel 项目中包含管理栏(如 WordPress)。

安装

您可以通过 composer 安装此包

composer require murdercode/laravel-admin-bar

您可以使用以下命令发布配置文件

php artisan vendor:publish --tag="admin-bar-config"

这是已发布配置文件的内容

<?php

// config for Murdercode/LaravelAdminBar
return [
    'style' => [
        'show3labsLogo' => true,
        'theme' => 'dark', // 'light' or 'dark'
        'max-width' => '1200px',
        'position' => 'bottom', // 'top' or 'bottom'
        'font-size' => '14px',
    ],
    'config' => [
        'adminUrl' => '/cms',
        'editPost' => [
            'enabled' => true,
            'uris' => ['articoli/{slug}', 'notizie/{slug}', 'recensioni/{slug}'], // detect the current route as defined in your routes/web.php
            'wildcard' => 'slug', // the wildcard for the parameter (as over)
            'parameterForSearch' => 'slug', // the parameter to be used for search the post
            'model' => \App\Models\Post::class, // the model to be used for search the post
            'parameterToReturn' => 'id', // the value to be returned
            'targetEndpointUrl' => '/cms/resources/posts/{parameter}',
        ],
        'emptyCachePost' => [
            'enabled' => true,
            'uris' => ['articoli/{slug}', 'notizie/{slug}', 'recensioni/{slug}'], // detect the current route as defined in your routes/web.php
            'wildcard' => 'post', // the wildcard for the parameter (as over)
            'parameterForSearch' => 'slug', // the parameter to be used for search the post
            'model' => \App\Models\Post::class, // the model to be used for search the post
            'parameterToReturn' => 'id', // the value to be returned
            'targetEndpointUrl' => '/posts/{parameter}?nocache',
        ],
    ],
];

可选地,您可以使用以下命令发布视图

php artisan vendor:publish --tag="laravel-admin-bar-views"

用法

在布局的任何部分,您可以使用以下代码包含管理栏

{{LaravelAdminBar::render()}}

测试

composer test

变更日志

有关最近更改的更多信息,请参阅 CHANGELOG

贡献

有关详细信息,请参阅 CONTRIBUTING

安全漏洞

有关如何报告安全漏洞,请参阅 我们的安全策略

鸣谢

许可证

MIT 许可证(MIT)。有关更多信息,请参阅 许可证文件