- What Laravel versions does laravel-admin/crud support, and is it production-ready?
- The package is explicitly labeled experimental and lacks official Laravel version support documentation. It may work with Laravel 10/11, but no guarantees exist for compatibility or production stability. Avoid critical projects until maintenance history improves.
- How do I customize form fields for create/edit views beyond basic text/textarea?
- Override `getFieldsForCreate()` or `getFieldsForEdit()` in your controller to define custom field types (e.g., dropdowns, checkboxes) using an array of configurations. Each field requires an `id`, `label`, `field` type, and optional metadata like `description` or `rules`.
- Can I use this package with Tailwind CSS or Alpine.js instead of Bootstrap?
- No, the package is tightly coupled to Bootstrap-compatible views. Attempting to replace them would require manual template overrides, which defeats the package’s purpose. Stick to Bootstrap or build custom views from scratch.
- How do I handle model relationships (e.g., belongsTo, hasMany) in forms?
- The package doesn’t natively support relationship fields in forms. You’d need to manually extend `getFieldsForCreate()` or `getFieldsForEdit()` with custom logic (e.g., nested loops for `hasMany`) or use JavaScript to populate related data dynamically.
- What’s the performance impact of using this package vs. manual CRUD controllers?
- The package adds minimal overhead for basic CRUD but may introduce slight latency due to dynamic view rendering and method overrides. For high-traffic apps, manual controllers with cached views could outperform it, though the difference is negligible for most admin panels.
- How do I add custom validation rules (e.g., conditional logic, custom messages)?
- Override `getValidationRulesOnStore()` or `getValidationRulesOnUpdate()` to return an array of rules. For complex logic, use Laravel’s built-in validation extensions (e.g., `Rule::unique()`) or inline closures, but the package doesn’t support conditional rules natively.
- Does this package work with Laravel Sanctum or API resources?
- No, it’s designed exclusively for web-based admin panels using Blade views and Bootstrap. For API resources, consider Laravel’s built-in `make:controller --api` or packages like `spatie/laravel-api-resources` instead.
- How do I test CRUD operations generated by this package?
- Test standard routes (e.g., `POST /blogs`, `GET /blogs`) using PHPUnit’s `Http::route()` or `Http::post()`. Mock the controller’s overridden methods (e.g., `getValidationRulesOnStore()`) to isolate logic. No built-in test helpers exist, so rely on Laravel’s core testing tools.
- What happens if I upgrade Laravel and this package breaks?
- Since it’s experimental, breaking changes are likely with Laravel upgrades. Mitigate risk by forking the package, implementing feature flags, or maintaining parallel manual controllers. Check the GitHub issues for upgrade notes, but assume no official support.
- Are there alternatives for Laravel CRUD with better maintenance or features?
- For production, consider `backpack/crud` (feature-rich but heavier) or `spatie/laravel-permission` + manual controllers (more control). For API-focused CRUD, `spatie/laravel-api-resources` is a robust alternative. Evaluate based on your need for speed vs. stability.