idevsmg/easyadmin
Composer 安装命令:
composer require idevsmg/easyadmin
包简介
Admin packages with easy crud, import and export table
README 文档
README
Admin packages with easy crud, import and export datas
Installation
-
Add package to composer.json
composer require idevsmg/easyadmin:dev-main
-
Add autoload to composer.json
"autoload": { "psr-4": { .... "Idev\\EasyAdmin\\": "vendor/idevsmg/easyadmin/src/" } }, -
Add provider to config/app.php providers
'providers' => ServiceProvider::defaultProviders()->merge([ ..... Idev\EasyAdmin\EasyAdminServiceProvider::class, ])->toArray(),For Laravel 11 you can add code below to bootstrap/providers.php:
return [ .... Idev\EasyAdmin\EasyAdminServiceProvider::class, ]; -
Run installation
composer dump-autoload php artisan vendor:publish --tag=install-idev --force
then you can doing migration and seeder
CRUD Generator
You can easily create your crud controller, let's enable command via app/Console/Kernel.php
protected $commands = [
....
\Idev\EasyAdmin\app\Console\Commands\ControllerMaker::class,
];
In laravel 11 you should add command in bootstrap/app.php
->withCommands([
Idev\EasyAdmin\app\Console\Commands\ControllerMaker::class,
])
make sure the table migration has been created then you just type:
php artisan idev:controller-maker --slug=your-route --table=your_table
for example you have database master_products and you want to access this page with route /master-product, so should do artisan like this:
php artisan idev:controller-maker --slug=master-product --table=master_products
Middleware CRUD (Optional)
We also prepare middleware for access control in your crud by adding snippet code below into kernel.php
protected $middlewareAliases = [ ..... 'middlewareByAccess' => \Idev\EasyAdmin\app\Http\Middleware\MiddlewareByAccess::class ];
And don't forget to implement this middleware into your route
Route::group(['middleware' => ['web', 'auth', 'middlewareByAccess']], function () {
......
});
Sample CRUD (Optional)
if you want to view our sample crud controller, you can publish sample-crud.
php artisan vendor:publish --tag=sample-crud --force
and set your like this
Route::group(['middleware' => ['web', 'auth']], function () {
Route::resource('sample-data', SampleDataController::class);
Route::get('sample-data-api', [SampleDataController::class, 'indexApi'])->name('sample-data.listapi');
Route::get('sample-data-export-pdf-default', [SampleDataController::class, 'exportPdf'])->name('sample-data.export-pdf-default');
Route::get('sample-data-export-excel-default', [SampleDataController::class, 'exportExcel'])->name('sample-data.export-excel-default');
Route::post('sample-data-import-excel-default', [SampleDataController::class, 'importExcel'])->name('sample-data.import-excel-default');
});
统计信息
- 总下载量: 337
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2023-12-08