1
0
Fork 0

command ResourceFill

main
panliang 2025-05-11 15:30:21 +08:00
parent d8fbfa5a8e
commit da554dc56a
4 changed files with 48 additions and 3 deletions

View File

@ -78,5 +78,5 @@ public function update($primaryKey, $data)
## TODO
- 表单验证: 服务端返回 `errors` 不生效, 示例文件: `app\Services\UserService.php`, [组件文档](https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%A0%A1%E9%AA%8C)
- 表单验证: 服务端返回 `errors` 错误信息, 未在输入框上显示, 示例文件: `app\Services\UserService.php`, [组件文档](https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#%E6%9C%8D%E5%8A%A1%E7%AB%AF%E6%A0%A1%E9%AA%8C)
- CURD 组件: 如果存在 `bulkActions` 按钮时, 表格会出现滚动条

View File

@ -22,7 +22,7 @@ class UserController extends AdminController
->headerToolbar([
$this->createButton('drawer', 'lg')->permission('admin.users.create'),
...$this->baseHeaderToolBar(),
$this->exportAction(),
$this->exportAction(true),
])
->bulkActions([
// $this->bulkDeleteButton()->permission('admin.users.delete')

View File

@ -19,7 +19,7 @@ class ModelFillable extends Command
*
* @var string
*/
protected $description = 'get model fillable ';
protected $description = 'print model fillable ';
/**
* Create a new command instance.

View File

@ -0,0 +1,45 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Schema;
class ResourceFill extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'resource:fill {name}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'print resource column';
/**
* Execute the console command.
*/
public function handle()
{
$name = $this->argument('name');
$columns = [];
if (class_exists("App\\Models\\{$name}")) {
$model = app("App\\Models\\{$name}");
$columns = $model->getFillable();
}
if (Schema::hasTable($name)) {
$columns = Schema::getColumnListing($name);
}
if (count($columns) <= 0) {
return $this->error("{$name} 不存在");
}
foreach($columns as $key) {
$this->info("'{$key}' => \$this->{$key},");
}
}
}