dkpankaj1/adminkit 问题修复 & 功能扩展

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

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

dkpankaj1/adminkit

Composer 安装命令:

composer require dkpankaj1/adminkit

包简介

A Laravel package for an admin dashboard kit with authentication, datatables, and UI components.

README 文档

README

Overview

AdminKit for Laravel provides a seamless way to integrate a customizable admin interface into your Laravel application. The install:adminkit Artisan command allows you to choose between two themes (Kadso or Drezoc) and automatically copies controllers, middleware, requests, view components, models, support files, views, assets, migrations, language files, and routes to your project.

Requirements

  • Laravel: 10.0 or higher
  • PHP: 8.0 or higher
  • Dependencies: Composer
  • File System: Write permissions for app, resources, public, database, and lang directories

Installation

Follow these steps to install and configure AdminKit in your Laravel project:

Step 1: Install via Composer

Run the following command to install the package:

composer require dkpankaj1/adminkit --dev

Step 2: Register Service Provider

Add the AdminKit service provider to bootstrap/providers.php:

Dkpankaj1\AdminKit\AdminKitServiceProvider::class

Step 3: Run the Installation Command

Execute the Artisan command to install AdminKit:

php artisan install:adminkit

This command will:

  1. Prompt you to select a theme (Kadso or Drezoc).
  2. Copy the following core files to your project:
    • Controllers to app/Http/Controllers
    • Middleware to app/Http/Middleware
    • Requests to app/Http/Requests
    • View Components to app/View/Components
    • Models to app/Models
    • Support Files to app/Support
    • Views to resources/views
    • Migrations to database/migrations
    • Language Files to lang
    • Routes to routes/admin.php
  3. Copy theme-specific views and assets to resources/views and public/assets, respectively.
  4. Prompt for confirmation before overwriting existing files or directories.

Run the command with verbose output to debug issues:

php artisan install:adminkit -v

Step 4: Run Migrations (Optional)

If migrations are included in the theme, run the following command to apply them:

php artisan migrate

Step 5: Register Middleware

Update bootstrap/app.php to include the admin middleware:

->withMiddleware(function (Middleware $middleware) {
    $middleware->alias(['admin' => \App\Http\Middleware\AdminAccess::class]);
})

Step 6: Register Routes

Modify bootstrap/app.php to include the admin routes:

->withRouting(
    web: [__DIR__ . '/../routes/web.php', __DIR__ . '/../routes/admin.php'],
    commands: __DIR__ . '/../routes/console.php'
)

File Structure

After running the install:adminkit command, your project will include the following structure for the selected theme:

LaravelProject/
├── app/
│   ├── Http/
│   │   ├── Controllers/         # Admin controllers
│   │   ├── Middleware/          # Admin middleware
│   │   ├── Requests/            # Form request classes
│   ├── View/
│   │   ├── Components/          # Blade view components
│   ├── Models/                  # Admin-related models
│   ├── Support/                 # Support classes
├── resources/
│   ├── views/                   # Blade templates for the selected theme
├── public/
│   ├── assets/                  # Theme assets (CSS, JS, images)
├── database/
│   ├── migrations/              # Database migrations
├── lang/
│   ├── en/                      # English language files
│   ├── es/                      # Other language files (if included)
├── routes/
│   ├── admin.php                # Admin routes

Configuration

Theme Selection

The install:adminkit command prompts you to choose between the Kadso or Drezoc theme. Each theme includes specific views and assets tailored to its design.

Overwrite Protection

If destination files or directories already exist, the command will prompt for confirmation before overwriting. To skip overwriting, answer "no" to the prompt, and the command will continue with the remaining files.

Language Files

Language files are copied to the lang directory (e.g., lang/en/messages.php). Ensure your application’s locale is set in config/app.php (e.g., 'locale' => 'en') to use the appropriate language.

Migrations

Migration files are copied to database/migrations. Ensure that migration files have unique timestamps or filenames to avoid conflicts. Verify this by checking the database/migrations directory after installation.

Notes

  • Permissions: Ensure write permissions for the app, resources, public, database, and lang directories. Use the following command if needed:

    chmod -R 775 storage/ bootstrap/ public/ database/ lang/

    On Linux/Mac, you may also need to set the correct owner:

    chown -R www-data:www-data .

    (Replace www-data with your web server user.)

  • Customization: You can extend or modify the InstallAdminKit.php command to customize the installation process for your project.

  • Locale Configuration: Verify that your application’s locale matches the language files provided by the theme.

  • Verbose Output: Use the -v flag with the install:adminkit command to see detailed progress and identify potential issues.

Troubleshooting

If you encounter issues during installation, try the following:

  • Command Hangs or Fails:

    • Run with verbose output: php artisan install:adminkit -v.
    • Check if source stub directories exist in the package (vendor/dkpankaj1/adminkit/stubs).
    • Ensure sufficient disk space on the server.
  • File Conflicts:

    • The command prompts before overwriting existing files. Back up conflicting files before proceeding.
    • Check for existing files in app, resources, public, database, and lang directories.
  • Permission Issues:

    • Ensure directories are writable: chmod -R 775 storage/ bootstrap/ public/ database/ lang/.
    • Verify the correct ownership for your web server user.
  • Migration Issues:

    • Verify that migration files have unique timestamps: ls database/migrations.
    • Run php artisan migrate:status to check for conflicts.
  • Cache Issues:

    • Clear configuration and cache:
      php artisan config:clear
      php artisan cache:clear

License

AdminKit for Laravel is open-source software licensed under the MIT License. You are free to use, modify, and distribute it as needed.

Support

For issues, questions, or contributions, please visit the GitHub repository or contact the maintainer.

dkpankaj1/adminkit 适用场景与选型建议

dkpankaj1/adminkit 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 81 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 dkpankaj1/adminkit 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 81
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-02