lakm/laravel-comments-admin-panel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lakm/laravel-comments-admin-panel

Composer 安装命令:

composer require lakm/laravel-comments-admin-panel

包简介

Integrate seamless commenting functionality into your Laravel project.

README 文档

README

Commenter Admin Panel

Admin panel for the commenter

Description | Requirements | Installation | Usage | Config | Authoriztion | Models Discovery | Route | Customization | Changelog | Security | License

GitHub Actions Workflow Status Packagist Version GitHub License

Description

Provides an ideal admin panel to manage the Commenter package.

Dashboard list Edit Form

Requirements

  • PHP : ^8.1 | ^8.2 | ^8.3
  • laravel/framework : ^ 10.0 | ^11.0
  • lakm/laravel-comments : *
  • filament/notifications : ^3.2
  • filament/tables : ^3.2

Installation

    composer require lakm/laravel-comments-admin-panel -W
    php artisan commenter-admin-panel:install

Optional

You can publish views using below command.

    php artisan vendor:publish --tag=comments-admin-panel-resources

Usage

All you need to do is navigate to the package's default route end point /admin/comments/dashboard

Config

Config file is published as comments-admin-panel.php in the config directory.

If it is missing, you can re-publish it using the command below.

php artisan vendor:publish --tag=comments-admin-panel-config

This will publish following config file

//config/comments-admin-panel.php
<?php

use LakM\CommentsAdminPanel\Middleware\AdminPanelAccessMiddleware;

return [
        'enabled' => true,
        'routes' => [
            'middlewares' => [
                'web',
                AdminPanelAccessMiddleware::class, // Removing this, allow users to access admin panel if enabled is set to true !
            ],
            'prefix' => 'admin',
        ],
        /**
         * Commentable models(must implement CommentableContract) that the admin panel must track
         * Keep empty to use models auto-discovery
         */
        'commentable_models' => [],
];

Authorization

By default, routes are enabled if it is not in production environment. You can change this behaviour by setting enabled variable to false in the config file.

'enabled' => false

Production

Before deploying to production (in production mode), the canAccessAdminPanel method must be implemented in the auth model; otherwise, you will receive a 404 status. This behaviour is handled by the AdminPanelAccessMiddleware::class middleware.

//config/comments-admin-panel.php
  public function canAccessAdminPanel(): bool
  {
     return true;
  }

Note

Don't forget to set 'enabled' => true in the config file.

Models Discovery

By default, package scan all the commentable models in App/Models namespace. You can change this behaviour by explicitly defining models you want admin panel to track.

//config/comments-admin-panel.php
return [
    'commentable_models' => [Post::class], // Admin panel only track for post class
]

Route

You can access to the admin panel visiting default route end point /admin/comments/dashboard

Prefix

By default, admin prefix is added to package's routes you can change it as following example.

'routes' => ['prefix' => 'admin'],

Middlewares

By default, web and AdminPanelAccessMiddleware::class middlewares are applied you can change it as following example.

 'routes' => [
            'middlewares' => [
                'web',
                AdminPanelAccessMiddleware::class, // Removing this, allow users to access admin panel if enabled is set to true !
            ],
        ],

Customization

You can customize all the views by publishing them using below commands,

    php artisan vendor:publish --tag=comments-admin-panel-resources

This will publish views to the \resources\views\comments-admin-panel directory.

Assets

Package's install command comments-admin-panel:install, publish assets to the \public\vendor\lakm\comments-admin-panel directory.

Here is the command to publish them manually.

    php artisan vendor:publish --tag=comments-admin-panel-assets

Build assets

You can build assets using any assets building tool. By default, package has used laravel vite plugin. Make sure to use right build directory public\vendor\lakm\comments-admin-panel\build

Important

When building assets the re should be only one input file and that is should be app.js. You can do that as following using vite.

// vite.config.js

import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
   plugins: [
       laravel({
           hotFile: 'public/vendor/lakm/comments-admin-panel/comments-admin-panel.hot',
           buildDirectory: 'vendor/lakm/comments-admin-panel/build', // This is important
           input: ['resources/js/app.js'], // This is important
           refresh: true,
       }),
   ],
});

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

Please see here for our security policy.

License

The MIT License (MIT). Please see License File for more information.

lakm/laravel-comments-admin-panel 适用场景与选型建议

lakm/laravel-comments-admin-panel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 275 次下载、GitHub Stars 达 17, 最近一次更新时间为 2024 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「admin」 「comments」 「laravel」 「livewire」 「alpine.js」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 lakm/laravel-comments-admin-panel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lakm/laravel-comments-admin-panel 我们能提供哪些服务?
定制开发 / 二次开发

基于 lakm/laravel-comments-admin-panel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 275
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 17
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 17
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-12