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

Admin Bundle Laravel Package

admin-project/admin-bundle

Admin bundle for Laravel projects, providing a ready-to-use admin foundation with common utilities and configuration to speed up building back-office features. Install, configure, and extend it to fit your app’s admin workflows and UI needs.

View on GitHub
Deep Wiki
Context7

Getting Started

First Steps

  1. Installation

    composer require admin-project/admin-bundle
    

    Publish the bundle’s assets and config:

    php artisan vendor:publish --provider="AdminProject\AdminBundle\AdminBundleServiceProvider" --tag="config"
    php artisan vendor:publish --provider="AdminProject\AdminBundle\AdminBundleServiceProvider" --tag="public"
    
  2. Basic Setup

    • Register the bundle in config/app.php under providers:
      AdminProject\AdminBundle\AdminBundleServiceProvider::class,
      
    • Run migrations (if included):
      php artisan migrate
      
  3. First Use Case: CRUD Interface

    • Define a model (e.g., User) and generate a controller:
      php artisan make:admin User
      
    • Configure routes in routes/admin.php (auto-generated by the bundle).

Implementation Patterns

Core Workflows

  1. Model Integration

    • Extend the bundle’s AdminController or use traits like AdminTrait for quick CRUD scaffolding.
    • Example:
      use AdminProject\AdminBundle\Traits\AdminTrait;
      
      class UserAdminController extends AdminController
      {
          use AdminTrait;
      
          protected $model = \App\Models\User::class;
      }
      
  2. Customization via Configuration

    • Override default settings in config/admin.php:
      'columns' => [
          'id' => 'ID',
          'name' => 'Name',
          'email' => 'Email',
      ],
      'filters' => ['name', 'email'],
      
  3. Field-Specific Logic

    • Use AdminField classes to customize form inputs, validation, or display:
      protected function configureFields()
      {
          return [
              'name' => new TextField(),
              'email' => new EmailField(),
              'active' => new BooleanField(),
          ];
      }
      
  4. API Integration

    • Leverage the bundle’s built-in API routes (if supported) for programmatic access:
      Route::apiResource('admin/users', UserAdminController::class);
      
  5. Middleware & Authentication

    • Protect admin routes with middleware (e.g., auth:admin):
      Route::middleware(['auth:admin'])->group(function () {
          require __DIR__.'/admin.php';
      });
      

Gotchas and Tips

Common Pitfalls

  1. Route Conflicts

    • Ensure routes/admin.php doesn’t clash with frontend routes. Use namespace prefixes:
      Route::prefix('admin')->group(function () {
          Route::resource('users', UserAdminController::class);
      });
      
  2. Model Binding Issues

    • Verify the model’s fillable/guarded attributes match the fields exposed in the admin panel to avoid mass-assignment errors.
  3. Asset Loading

    • If CSS/JS fails to load, check the published assets in public/vendor/admin-bundle/ and clear cached views:
      php artisan view:clear
      
  4. Database Migrations

    • The bundle may not include migrations. Manually create them if needed and ensure they align with the admin model’s structure.

Pro Tips

  1. Extend the Bundle

    • Override the bundle’s views in resources/views/vendor/admin-bundle/ for theming.
  2. Debugging

    • Enable debug mode in config/admin.php to log queries or errors:
      'debug' => env('APP_DEBUG', false),
      
  3. Performance

    • Use eager loading for relationships in the admin controller:
      protected $with = ['posts']; // For a User model with posts relationship
      
  4. Localization

    • Translate labels/placeholders by publishing the language files:
      php artisan vendor:publish --tag=admin-lang
      
  5. Testing

    • Mock the admin controller in PHPUnit:
      $this->actingAs($adminUser)
           ->get('/admin/users')
           ->assertStatus(200);
      
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky