command ResourceFill
parent
d8fbfa5a8e
commit
da554dc56a
|
|
@ -78,5 +78,5 @@ public function update($primaryKey, $data)
|
||||||
|
|
||||||
## TODO
|
## 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` 按钮时, 表格会出现滚动条
|
- CURD 组件: 如果存在 `bulkActions` 按钮时, 表格会出现滚动条
|
||||||
|
|
@ -22,7 +22,7 @@ class UserController extends AdminController
|
||||||
->headerToolbar([
|
->headerToolbar([
|
||||||
$this->createButton('drawer', 'lg')->permission('admin.users.create'),
|
$this->createButton('drawer', 'lg')->permission('admin.users.create'),
|
||||||
...$this->baseHeaderToolBar(),
|
...$this->baseHeaderToolBar(),
|
||||||
$this->exportAction(),
|
$this->exportAction(true),
|
||||||
])
|
])
|
||||||
->bulkActions([
|
->bulkActions([
|
||||||
// $this->bulkDeleteButton()->permission('admin.users.delete')
|
// $this->bulkDeleteButton()->permission('admin.users.delete')
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class ModelFillable extends Command
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $description = 'get model fillable ';
|
protected $description = 'print model fillable ';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new command instance.
|
* Create a new command instance.
|
||||||
|
|
|
||||||
|
|
@ -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},");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue