ekolustudio/crudit
Laravel package for rapid CRUD scaffolding and admin-style interfaces. Generate controllers, models, views and routes to speed up building create/read/update/delete features with less boilerplate and a consistent structure.
Installation
composer require ekolustudio/crudit
Publish the package config (if needed):
php artisan vendor:publish --provider="Ekolustudio\Crudit\CruditServiceProvider"
Basic Usage
Register the CRUD routes in routes/web.php:
use Ekolustudio\Crudit\Facades\Crudit;
Crudit::routes('App\Models\User'); // Auto-generates CRUD routes for User model
First Use Case
/crudit/users for listing, /crudit/users/create for creation).config/crudit.php) or service provider overrides.Model-Based CRUD
Crudit::routes('App\Models\Post', [
'except' => ['destroy'], // Exclude soft-delete route
'only' => ['index', 'store'], // Include only specific actions
]);
Customization via Config
'views' => [
'prefix' => 'crudit::custom.',
],
'middleware' => ['auth', 'verified'],
Integration with Existing Apps
resources/views/crudit/custom/index.blade.php).Crudit::controller() to build custom APIs:
$controller = Crudit::controller('App\Models\Product');
$controller->index(request());
Form Customization
crudit_form directive in Blade:
{!! crudit_form('App\Models\Order', 'update') !!}
Crudit::routes('App\Models\Project', [
'bindings' => ['project' => 'slug'], // Bind by slug instead of ID
]);
Crudit::policy('App\Models\Post', \App\Policies\PostPolicy::class);
Route Conflicts
/crudit/{model}) don’t clash with existing routes. Use namespace in config:
'routes' => [
'namespace' => 'Crudit\Controllers',
],
Model Requirements
crudit_form with custom fields:
{!! crudit_form('App\Models\Post', 'create', [
'fields' => ['title', 'custom_field'],
]) !!}
Caching Issues
php artisan config:clear
Middleware Gaps
'middleware' => ['auth:sanctum', 'throttle:60'],
dd(Route::getRoutes()->getByName('crudit.*'));
app/Crudit/Controllers (if not cached). Override them for full control.Crudit::extend('App\Models\Post', function ($controller) {
$controller->addAction('publish', 'App\Http\Controllers\PublishPost');
});
vendor/ekolustudio/crudit/resources/views to resources/views/crudit and modify.crudit_form or override the rules method in the generated controller.How can I help you explore Laravel packages today?