pawanyd/global-crud is a Laravel package for a global crud package for laravel.
It currently has 0 GitHub stars and 1 downloads on Packagist.
Install it with composer require pawanyd/global-crud.
Discover more Laravel packages by pawanyd
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package that provides a single controller (GlobalController) to handle CRUD operations for multiple models, using dynamic form generation and dynamic index listings. This setup significantly reduces boilerplate when building CRUD features for different entities.
Ensure you have a functional Laravel project with database connectivity set up before installing this package.
composer require pawanyd/global-crud:dev-main
php artisan global-crud:install
or
php artisan vendor:publish --tag=global-crud-stubs
These commands will copy:
In routes/web.php:
use App\Http\Controllers\GlobalController;
Route::get('/{model}', [GlobalController::class, 'index'])->name('global.index');
Route::get('/{model}/create', [GlobalController::class, 'create'])->name('global.create');
Route::post('/{model}', [GlobalController::class, 'store'])->name('global.store');
Route::get('/{model}/{id}', [GlobalController::class, 'show'])->name('global.show');
Route::get('/{model}/{id}/edit', [GlobalController::class, 'edit'])->name('global.edit');
Route::put('/{model}/{id}', [GlobalController::class, 'update'])->name('global.update');
Route::delete('/{model}/{id}', [GlobalController::class, 'destroy'])->name('global.destroy');
You can prefix these routes (e.g., /admin/{model}) to avoid collisions with other routes.
php artisan make:model ModelName
Create Eloquent models (e.g., User, Post, Product) in app/Models.
No need to define $fillable if using forceFill().
GET /{model}GET /{model}/createPOST /{model}GET /{model}/{id}/editPUT /{model}/{id}DELETE /{model}/{id}For instance, GET /user lists User records; GET /user/create opens the create form.
The table schema is introspected:
varchar/text → text inputtinyint(1) → checkboxenum → select dropdowndate → date inputint → number inputBy default, GlobalController uses:
$items = $modelClass::paginate(10);
Adjust the 10 as needed. Blade uses {{ $items->links() }} for pagination links.
Class Not Found
src/GlobalCrudServiceProvider.php matches composer.json PSR-4.MassAssignmentException
forceFill() to bypass $fillable. Removing it requires $fillable or Model::unguard().Publishing Issues
php artisan global-crud:install does nothing, try:
php artisan vendor:publish --tag=global-crud-stubs --force
app/Http/Controllers and resources/views.Your contributions, bug reports, and feature requests are always welcome!
This package is released under the MIT License.
You are free to use, modify, and distribute this package in both commercial and personal projects as permitted by the MIT license.