- Can I use this package to generate CRUD for a Laravel 11 project?
- The package officially supports Laravel 10+, but it may not include Laravel 11-specific optimizations or bug fixes. Test thoroughly in a staging environment before production use, or check the GitHub issues for compatibility updates.
- How do I customize the generated Livewire components or Blade views?
- You can override the default stubs by publishing the package config with `php artisan vendor:publish --tag=crud` and modifying the stub files in the `resources/views/vendor/crud` directory. For deeper customization, extend the generated components manually.
- Does this package support polymorphic relationships in Eloquent models?
- No, the package does not natively scaffold polymorphic relations. You’ll need to manually add these to the generated model and migration after creation, as the CLI prompts don’t include options for complex Eloquent features like polymorphic morphs.
- Will this break existing routes if I generate a new CRUD module?
- The package generates standard `Route::resource` paths, which may conflict with custom route groups or API versioning (e.g., `/api/v1/posts`). Review your existing routes before generation, or use the `--prefix` option if supported to avoid clashes.
- Can I integrate this with a React/Vue frontend instead of Blade views?
- The generated views are Blade-based by default, so you’ll need to manually convert them to JSON API responses or use Inertia.js to bridge Laravel with React/Vue. The package doesn’t provide built-in SPA support, but you can override the API controller stubs to return JSON.
- How do I add validation rules or custom logic to the generated controllers?
- The generated controllers include basic validation, but you’ll need to extend them manually for complex rules. Override the `rules()` method in the controller or use form request classes. The package doesn’t scaffold validation logic by default.
- Does this package work with Laravel Sanctum or Passport for API authentication?
- Yes, the generated API controllers will work with Sanctum or Passport, but you’ll need to manually configure middleware in the `HandleIncomingInertiaRequests` or `Authenticate` middleware groups to protect the routes.
- Can I generate CRUD for a database with composite keys or JSON columns?
- The package assumes simple fillable fields and primary keys. For composite keys or JSON columns, you’ll need to manually edit the generated migration and model after creation, as the CLI doesn’t support these advanced schema types.
- How do I test the generated CRUD functionality in PHPUnit or Pest?
- The package doesn’t scaffold tests, so you’ll need to manually write feature tests for the generated routes, controllers, and Livewire components. Use Laravel’s built-in testing helpers to assert HTTP responses or Livewire component interactions.
- What are the alternatives to this package for Laravel CRUD generation?
- Alternatives include `laravel-shift/crud-generator` (more customizable but less opinionated), `spatie/laravel-model-generator` (focused on models/migrations), and `orchid/software` (admin panel with CRUD). Choose based on whether you need tight Laravel integration or flexibility for non-standard architectures.