创建一个模块
create module
php artisan module:make AuthorVendor
php artisan module:make FooHello
create back-controller
php artisan module:make-back-controller FooHellos FooHello
create model and migration
php artisan module:make-back-model FooHello FooHello -m
Schema::create('foo_hellos', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->timestamps();
});
php artisan module:migrate FooHello
create Plugin.php
php artisan module:make-back-plugin FooHello
register side menu
in Plugin.php
public function registerSideNavSettings()
{
return [
'foohellos' => [
'label' => 'FooHello',
'description' => '',
'category' => 'FooHello',
'icon' => 'icon-pencil',
'url' => Backend::url('foohello/foohellos'),
'order' => 500,
'context'=>['modules.foohello'],
'keywords' => 'foohellos',
'permissions' => [],
],
];
}
config form
in Models/
fields.yaml
fields:
name:
label: Name
columns.yaml
columns:
id:
label: ID
searchable: true
name:
label: Name
searchable: true
enableEdit: true
action:
label: 操作
searchable: false
sortable: false
type: partial
cssClass: flex border-dashed border-gray-200
推荐文章: