- How do I install Sharp in a Laravel 11+ project?
- Run `composer require code16/sharp` to install via Composer. Then publish the assets with `php artisan vendor:publish --tag=sharp-assets --force` and configure the package by editing `config/sharp.php`. Sharp follows Laravel conventions, so no additional setup is needed beyond the docs.
- Can Sharp work with non-Eloquent models or custom databases?
- Yes, Sharp is data-agnostic and works with Eloquent, custom ORMs, or even non-database storage. You’ll need to implement a simple adapter for your persistence layer, but the core API remains unchanged. Check the docs for adapter examples.
- Does Sharp support role-based access control (RBAC) beyond basic authorization?
- Sharp integrates with Laravel’s built-in authorization (e.g., Gates, Policies) and supports custom validation logic. For RBAC, extend Laravel’s auth system or use middleware to gate Sharp actions. The package avoids coupling, so you retain full control over permissions.
- Will Sharp work with my existing Laravel 10 or older project?
- No, Sharp requires **Laravel 11+ and PHP 8.3+**. Upgrading may require significant changes, especially if using older Laravel features. If you’re on an unsupported version, consider alternatives like Backpack for Laravel or custom admin panels.
- How does Sharp handle large datasets (e.g., 100K+ records) for listing/searching?
- Sharp uses Laravel’s query builder and supports pagination, lazy loading, and global filters. For large datasets, optimize with database indexes, chunked queries, or caching. Test performance under load—Sharp is optimized but not a replacement for specialized search engines like Algolia.
- Can I customize the UI beyond the default Sharp templates?
- Sharp provides a clean UI by default but is frontend-agnostic. For heavy customization, override Blade templates or use **Inertia.js** to build a custom SPA. The package avoids locking you into its views, so you can replace components entirely if needed.
- How do I add custom bulk actions (e.g., export, soft-delete) to Sharp’s CRUD?
- Use Sharp’s **command system** to define custom actions. Register them in your `SharpAppServiceProvider` and bind them to UI buttons via the API. Commands can target single items, selections, or all records, with full access to Laravel’s services.
- Does Sharp include media/file uploads or WYSIWYG editors?
- No, Sharp focuses on **structured data** (e.g., tables, forms) and avoids built-in media management. For files, integrate Laravel’s storage system or packages like Spatie Media Library. WYSIWYG support would require a custom UI component or Inertia.js integration.
- How does Sharp handle validation errors in the UI?
- Sharp leverages Laravel’s validation system and displays errors in the UI automatically. Customize error messages via validation rules or override the default error rendering in Blade/Inertia. The API returns structured error responses for frontend handling.
- Are there alternatives to Sharp for Laravel CMS/admin panels?
- Yes. For **code-driven** solutions, consider **Backpack for Laravel** (more feature-rich but less data-agnostic) or **Filament** (modern UI with tighter coupling). For **headless CMS**, use **Strapi** or **Sanity**. Sharp stands out for its **decoupled, API-first** approach with minimal frontend requirements.