Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Adminlte Generator Bundle Laravel Package

donjohn/adminlte-generator-bundle

Deprecated/abandoned AdminLTE generator bundle. Project has been canceled; use EasyAdminBundle instead: https://github.com/javiereguiluz/EasyAdminBundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Verify Compatibility Check if the package works with your Laravel version (likely outdated). Test in a fresh project:

    composer create-project laravel/laravel test-adminlte
    cd test-adminlte
    composer require donjohn/adminlte-generator-bundle
    
  2. Publish Config Run:

    php artisan vendor:publish --tag=adminlte-generator-config
    

    Edit config/adminlte_generator.php to set:

    • default_namespace (e.g., Admin)
    • theme (AdminLTE assets path)
    • crud_routes (e.g., ['posts' => 'App\Models\Post']).
  3. Generate a CRUD Define a route in routes/web.php:

    use DonJohn\AdminLteGeneratorBundle\Routing\GeneratorRouter;
    $router = new GeneratorRouter();
    $router->add('posts', 'App\Models\Post', ['fields' => ['title', 'content']]);
    

    Run:

    php artisan adminlte:generate
    

    Access /admin/posts (note: may require php artisan route:list to confirm).


First Use Case: Quick Admin Panel

Use this for internal tools (e.g., content moderation):

  1. Generate CRUD for a ModerationRequest model:
    $router->add('moderation', 'App\Models\ModerationRequest', [
        'fields' => ['user_id', 'status', 'created_at'],
        'title' => 'Moderation Dashboard',
        'icon' => 'fas fa-gavel'
    ]);
    
  2. Customize the AdminLTE sidebar by overriding:
    resources/views/adminlte_generator/partials/sidebar.blade.php
    

Implementation Patterns

Workflow: Rapid Prototyping

  1. Scaffold a Model

    php artisan make:model Report -m
    

    Add fields to the migration (e.g., title, data, user_id).

  2. Auto-Generate CRUD Update GeneratorRouter and regenerate:

    php artisan adminlte:generate
    

    Access /admin/reports.

  3. Iterate with Templates Override index.blade.php for custom columns:

    {# resources/views/adminlte_generator/reports/index.blade.php #}
    <table class="table">
        <thead>
            <tr>
                <th>Title</th>
                <th>User</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            {% for report in reports %}
            <tr>
                <td>{{ report.title }}</td>
                <td>{{ report.user->name }}</td>
                <td>
                    <a href="{{ path('admin_reports_edit', {'id': report.id}) }}">Edit</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
    

Integration Tips

  1. Leverage AdminLTE Widgets Add charts or widgets to the dashboard by extending:

    resources/views/adminlte_generator/partials/content_header.blade.php
    

    Example:

    <div class="box">
        <div class="box-header">
            <h3 class="box-title">Reports Overview</h3>
        </div>
        <div class="box-body">
            <canvas id="reportChart" height="300"></canvas>
        </div>
    </div>
    
  2. Custom Actions Extend the generated controller:

    namespace App\Http\Controllers\Admin;
    use DonJohn\AdminLteGeneratorBundle\Controller\CrudController;
    
    class ReportCrudController extends CrudController {
        public function exportAction() {
            // Custom logic (e.g., export to CSV)
            return response()->download(...);
        }
    }
    

    Add a route:

    Route::get('/admin/reports/export', [ReportCrudController::class, 'exportAction']);
    
  3. Form Customization Use AdminLTE’s input groups or custom components:

    <div class="form-group">
        {{ form_label(form.title, 'Report Title') }}
        <div class="input-group">
            {{ form_widget(form.title) }}
            <span class="input-group-addon"><i class="fa fa-tag"></i></span>
        </div>
    </div>
    

Debugging Workflows

  1. Check Generated Routes Run:

    php artisan route:list | grep admin
    

    Verify routes like admin_posts_index exist.

  2. Inspect Templates Dump the rendered template to debug:

    // In a controller
    dd(view()->render('adminlte_generator::posts/index'));
    
  3. AdminLTE Asset Issues If CSS/JS fails, clear caches:

    php artisan cache:clear
    php artisan view:clear
    

    Ensure public/adminlte exists (copy from vendor/adminlte).


Gotchas and Tips

Pitfalls

  1. Deprecated Package Risks

    • No Laravel 10+ Support: May fail with ClassNotFound errors for newer Laravel classes. Fix: Fork the repo and update dependencies (e.g., symfony/routing).
    • AdminLTE Version Lock: Hardcoded paths to adminlte assets may break if you update AdminLTE. Fix: Override asset paths in config/adminlte_generator.php:
      'theme' => public_path('adminlte'), // Custom path
      
  2. Template Overrides

    • Blade Syntax Conflicts: Generated templates use old Blade syntax (e.g., {% if %}). Update to {{ }}/@ directives.
    • Missing Partial Files: If a partial (e.g., form_row.blade.php) is missing, copy it from vendor/ to resources/views/adminlte_generator/partials/.
  3. Route Conflicts

    • Duplicate Routes: If you manually define routes for the same model, the generator may overwrite them. Fix: Exclude models from generation:
      $router->exclude('App\Models\Post');
      
  4. Database Schema Assumptions

    • No Polymorphic Relations: The generator may not handle morphTo or morphMany fields. Fix: Customize the show template to manually render polymorphic data.
  5. Authentication Bypass

    • No Built-in Auth: The package assumes you’ve set up auth (e.g., Laravel Breeze). Add middleware:
      Route::middleware(['auth:sanctum'])->group(function () {
          $router->add('posts', 'App\Models\Post');
      });
      

Debugging Tips

  1. Enable Debug Mode Set APP_DEBUG=true in .env to see template errors.

  2. Check Generator Logs Run with verbose output:

    php artisan adminlte:generate --verbose
    
  3. AdminLTE Console Errors Open browser dev tools (F12) to catch JS errors (e.g., missing jQuery plugins).

  4. Common Errors & Fixes

    Error Solution
    Class 'DonJohn\AdminLteGeneratorBundle...' not found Update Composer autoloader: composer dump-autoload.
    Call to undefined method Fork the package and add missing methods (e.g., getFields()).
    Blank admin panel Check resources/views/adminlte_generator/layouts/master.blade.php.
    CSRF token errors Ensure @csrf is in forms or use {{ csrf_field() }}.

Extension Points

  1. Custom Field Types Extend the generator to support custom fields (e.g., RichText, DateRange):

    // In a service provider
    $generator->addFieldType('richtext', function ($field) {
        return '<div class="form-group">' . $field->widget . '</div>';
    });
    
  2. Dynamic Sidebars Override sidebar.blade.php to fetch menu items dynamically:

    <ul class="sidebar-menu">
        {% for item in getMenuItems() %}
        <li class="treeview">
            <a href="{{ item.link }}">
                <i class="{{ item.icon }}"></i> <span>{{ item.title }}</span>
            </a>
        </li>
        {% endfor %}
    </ul>
    
  3. Event Listeners Hook into generation events (if the package supports them) to modify output:

    // In AppServiceProvider@boot()
    event(new \DonJohn\AdminLteGeneratorBundle\Events\CrudGenerated($crud));
    

Performance Quirks

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
capell-app/block-library
capell-app/frontend
capell-app/admin
capell-app/core
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
directorytree/privacy-filter-classifier
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php