Commands
Danh sách đầy đủ 61 lệnh của plugin DevTool trên SkillDo CMS v8.
Lưu ý quan trọng: DevTool không có CLI. Mọi lệnh chạy trong Terminal của admin (nút Terminal trên thanh header, chỉ hiện với tài khoản root), gửi qua ajax
POST /admin/ajax. Không chạy được từ shell/SSH.
Quy ước ký hiệu trong tài liệu:
[<arg>]— tham số bắt buộc REQUIRED[<arg>?]— tham số tùy chọn Optional[<arg>=giá-trị]— tham số tùy chọn có giá trị mặc định--option— cờ tùy chọn
Hai biến thể :plugin và :theme của cùng một lệnh chỉ khác nơi ghi file:
:plugin→ ghi vàoplugins/<plugin>/…:theme→ ghi vào theme conviews/<theme-child>/…(trừmake:lang:theme,make:widget*ghi vào theme cha)
Auth
User
user:username
Thay đổi tên đăng nhập của một user
Arguments
- usernameOld - username hiện tại của account REQUIRED
- usernameNew - username mới REQUIRED
user:username [<usernameOld>] [<usernameNew>]
user:username hello xinchao
user:password
Thay đổi mật khẩu đăng nhập của một user
Arguments
- username - username của account muốn đổi mật khẩu REQUIRED
- password - mật khẩu mới REQUIRED
user:password [<username>] [<password>]
user:password xinchao 1234Game
Cache
Cms
cms:version
Lấy thông tin phiên bản của cms
Arguments
- type - loại version cần lấy:
current(mặc định),lastOptional
cms:version [<type=current>]
Builder
Xuất / nhập cấu hình Page Builder của một section dưới dạng JSON. Section hợp lệ: header, home, footer.
builder:export
Xuất section của Page Builder ra file JSON.
File được ghi vào storage/cms/builder/, mặc định tên <section>.json.
Arguments
- section -
header|home|footerREQUIRED - file - tên file JSON đích Optional
builder:export [<section>] [<file>?]
builder:export header
builder:export home home-v2.json
builder:import
Nhập section của Page Builder từ file JSON trong storage/cms/builder/.
Trước khi ghi đè, lệnh tự sao lưu cấu hình hiện tại vào storage/cms/builder/backups/<section>_backup_<ngày_giờ>.json. Dùng --no-backup để bỏ qua bước này.
Arguments
- section -
header|home|footerREQUIRED - file - tên file JSON nguồn (mặc định
<section>.json) Optional
Options
- --no-backup - không sao lưu cấu hình hiện tại Optional
builder:import [<section>] [<file>?] [--no-backup]
builder:import header
builder:import home home-v2.json --no-backup
Db
db:empty
Xóa sạch dữ liệu của một table
Arguments
- table - tên table muốn empty REQUIRED
db:empty [<table>]
db:table
Hiển thị thông tin chi tiết của một table (cột, kiểu dữ liệu, index)
Arguments
- table - tên table REQUIRED
db:table [<table>]
db:run:plugin
Thực thi file migration của một plugin được chỉ định.
File nằm trong plugins/<plugin>/database/.
Arguments
- plugin - tên thư mục plugin REQUIRED
- file - tên file migration, mặc định
databaseOptional
db:run:plugin [<plugin>] [<file=database>]
db:run:plugin sicommerce
db:run:plugin sicommerce update-8-1-0
db:run:theme
Thực thi file migration của theme con.
File nằm trong views/<theme-child>/database/.
Arguments
- file - tên file migration, mặc định
databaseOptional
db:run:theme [<file=database>]
db:seed
Sinh dữ liệu giả ngẫu nhiên cho một module
Arguments
- number - số lượng bản ghi, từ 1 đến 50, mặc định 10 Optional
Options
- --module= - module cần sinh dữ liệu (vd
post) REQUIRED
db:seed [--module=<module>] [<number=10>]
db:seed --module=post 20
Lang
lang:build
Build file json ngôn ngữ
Arguments
- type - loại ngôn ngữ cần build REQUIRED
lang:build [<type>]
License
license:change
Thay đổi thông tin bản quyền
Arguments
- key - license key REQUIRED
- secretKey - secret key REQUIRED
license:change [<key>] [<secretKey>]
Plugin
plugin
Hiển thị danh sách plugin hoặc thông tin của một plugin
Arguments
- name - tên thư mục plugin, mặc định
allOptional
plugin [<name=all>]
plugin:activate
Kích hoạt một plugin
Arguments
- folder - tên thư mục plugin REQUIRED
plugin:activate [<folder>]
plugin:deactivate
Ngừng kích hoạt một plugin
Arguments
- folder - tên thư mục plugin REQUIRED
plugin:deactivate [<folder>]
Role
role:cap
Hiển thị danh sách quyền (capability) của một nhóm quyền
Arguments
- role - key của role REQUIRED
role:cap [<role>]
Theme
theme:child:copy
Sao chép một file hoặc thư mục từ theme cha sang theme con. Báo lỗi nếu theme đang dùng chính là theme con.
Arguments
- source - đường dẫn tương đối tính từ gốc theme cha REQUIRED
theme:child:copy [<source>]
theme:child:copy layouts/master.blade.php
theme:child:copy elements/banner
Make — Plugin & Command
make:plugin
Tạo bộ khung một plugin mới trong plugins/<folder>/: plugin.json, index.php, ActivatorService, DeactivatorService, routes/admin.php.
Arguments
- folder - tên thư mục plugin (kebab-case) REQUIRED
make:plugin [<folder>]
make:command
Tạo một lệnh DevTool mới trong plugins/DevTool/app/Console/<class>.php.
Arguments
- class - tên class command REQUIRED
make:command [<class>]
Sau khi tạo lệnh PHP, phải bổ sung tên lệnh vào bảng autocomplete
TerminalDevTool.commandstrongplugins/DevTool/assets/js/devtool.jsrồi chạy lạicms:build:js.
Make — Cấu trúc code
Nhóm lệnh có hai biến thể :plugin / :theme. Đích ghi file:
| Lệnh | :plugin → plugins/<plugin>/ | :theme → views/<theme-child>/ |
|---|---|---|
make:ajax:* | app/Ajax/<Name>Ajax.php | app/Ajax/<Name>Ajax.php |
make:controller:* | app/Controllers/<Name>Controller.php | app/Controllers/<Name>Controller.php |
make:provider:* | app/Providers/<Name>ServiceProvider.php | app/Providers/<Name>ServiceProvider.php |
make:services:* | app/Services/<Name>Service.php | app/Services/<Name>Service.php |
make:supports:* | app/Supports/<Name>.php | app/Supports/<Name>.php |
make:macro:* | app/Macros/<Class>.php | app/Macros/<Class>.php |
make:middleware:* | app/Middlewares/<Class>.php | app/Middlewares/<Class>.php |
make:column:* | app/Cms/Table/Columns/<Class>.php | app/Cms/Table/Columns/<Class>.php |
make:form-field:* | app/Cms/Form/Field/<Class>.php | app/Cms/Form/Field/<Class>.php |
make:popover:* | app/Cms/Form/Popovers/<Class>.php | app/Cms/Form/Popovers/<Class>.php |
make:model:* | app/Models/<Class>.php | app/Models/<Class>.php |
make:db:* | database/<file>.php | database/<file>.php |
Tham số name/class chấp nhận dạng Thu\Muc\Con\TenClass để tạo file trong thư mục con kèm namespace tương ứng.
make:ajax:plugin / make:ajax:theme
Tạo class xử lý Ajax.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - name - tên class (hậu tố
Ajaxđược thêm tự động) REQUIRED
make:ajax:plugin [<plugin>] [<name>]
make:ajax:theme [<name>]
make:controller:plugin / make:controller:theme
Tạo controller (hậu tố Controller được thêm tự động).
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - name - tên class REQUIRED
make:controller:plugin [<plugin>] [<name>]
make:controller:theme [<name>]
make:provider:plugin / make:provider:theme
Tạo Service Provider (hậu tố ServiceProvider được thêm tự động).
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - name - tên class REQUIRED
make:provider:plugin [<plugin>] [<name>]
make:provider:theme [<name>]
Provider tạo ra vẫn phải khai vào
providerstrongplugin.json/theme-child.jsonthì mới được nạp.
make:services:plugin / make:services:theme
Tạo class Service (hậu tố Service được thêm tự động).
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - name - tên class REQUIRED
make:services:plugin [<plugin>] [<name>]
make:services:theme [<name>]
make:supports:plugin / make:supports:theme
Tạo class Support (helper dùng chung).
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - name - tên class REQUIRED
make:supports:plugin [<plugin>] [<name>]
make:supports:theme [<name>]
make:macro:plugin / make:macro:theme
Tạo file macro.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - class - tên file macro REQUIRED
make:macro:plugin [<plugin>] [<class>]
make:macro:theme [<class>]
app/Macrosđược nạp theo file, không qua PSR-4 — file macro không đặt namespace.
make:middleware:plugin / make:middleware:theme
Tạo middleware và tự đăng ký alias vào middlewares.aliases của plugin.json (bản :plugin) hoặc theme-child.json (bản :theme).
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - class - tên class middleware REQUIRED
make:middleware:plugin [<plugin>] [<class>]
make:middleware:theme [<class>]
make:column:plugin / make:column:theme
Tạo class column dùng cho bảng dữ liệu admin (SKDObjectTable).
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - class - tên class column REQUIRED
make:column:plugin [<plugin>] [<class>]
make:column:theme [<class>]
make:form-field:plugin / make:form-field:theme
Tạo class field cho Form và tự đăng ký vào cms.form.fields của plugin.json / theme-child.json.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - class - tên class field REQUIRED
make:form-field:plugin [<plugin>] [<class>]
make:form-field:theme [<class>]
make:popover:plugin / make:popover:theme
Tạo class popover cho Form và tự đăng ký vào cms.form.popover của plugin.json / theme-child.json.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - class - tên class popover REQUIRED
make:popover:plugin [<plugin>] [<class>]
make:popover:theme [<class>]
make:lang:plugin / make:lang:theme
Tạo file bản dịch cho tất cả ngôn ngữ đang bật.
:plugin→plugins/<plugin>/language/<locale>/<file>.php:theme→views/<theme-cha>/language/<locale>/<file>.php
Chú ý:
make:lang:themeghi vào theme cha, không phải theme con —LanguageServiceProviderchỉ nạp bản dịch từ theme cha.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - file - tên file bản dịch REQUIRED
make:lang:plugin [<plugin>] [<file>]
make:lang:theme [<file>]
Make — Dữ liệu
make:db:plugin / make:db:theme
Tạo file migration.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - file - tên file, mặc định
databaseOptional
make:db:plugin [<plugin>] [<file=database>]
make:db:theme [<file=database>]
make:model:plugin / make:model:theme
Tạo class Model từ tên bảng.
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - table - tên bảng dữ liệu REQUIRED
Options
- --db - tạo kèm file migration trong
database/Optional
make:model:plugin [<plugin>] [<table>] [--db]
make:model:theme [<table>] [--db]
make:model:theme books
make:model:theme books --db
make:table
Tạo class bảng dữ liệu admin trong app/Modules/Admin/<class>.php.
Arguments
- table - tên bảng dữ liệu REQUIRED
- class - tên class table REQUIRED
Options
- --plugin= - tạo trong plugin thay vì theme con Optional
make:table [<table>] [<class>] [--plugin=<plugin>]
make:module:plugin / make:module:theme
Tạo trọn bộ một module CRUD admin và tự nối route vào routes/admin.php:
app/Modules/Admin/<Module>/<Module>Table.php
app/Modules/Admin/<Module>/<Module>Form.php
app/Modules/Admin/<Module>/<Module>Service.php
app/Models/<Module>.php
app/Controllers/Admin/<Module>Controller.php
bootstrap/<module>.php
routes/admin-<module>.php
Arguments
- plugin - (chỉ bản
:plugin) tên thư mục plugin REQUIRED - module - tên module REQUIRED
- table - tên bảng dữ liệu REQUIRED
make:module:plugin [<plugin>] [<module>] [<table>]
make:module:theme [<module>] [<table>]
make:module:theme books books
make:taxonomy
Tạo Service đăng ký taxonomy kèm hook add_action('init', …) trong bootstrap/.
Arguments
- postType - tên post type REQUIRED
- cateType - tên category type nếu có Optional
Options
- --plugin= - tạo trong plugin thay vì theme con Optional
make:taxonomy [<postType>] [<cateType>?] [--plugin=<plugin>]
make:taxonomy services service_categories
Make — Giao diện
make:element
Tạo class element cho Page Builder trong views/<theme-child>/elements/<folder>/ và tự đăng ký vào elements/elements.json.
Arguments
- folder - tên thư mục element (chỉ chữ, số, dấu
-) REQUIRED - class - tên class Optional
- file - tên file
.widget.phpOptional
Options
- --type= - nhóm đăng ký:
general(mặc định),header,footerOptional
make:element [<folder>] [<class>?] [<file>?] [--type=general]
make:element banner
make:element menu-top --type=header
Element
header/footerchỉ dùng được trong đúng phạm vi đó;generaldùng được ở mọi nơi.
make:widget
Tạo class widget trong views/<theme-cha>/widget/<folder>/ và tự đăng ký vào widget/widget.json.
Arguments
- folder - tên thư mục widget REQUIRED
- class - tên class Optional
- file - tên file widget Optional
Options
- --type= - nhóm đăng ký:
block(mặc định),footerOptional
make:widget [<folder>] [<class>?] [<file>?] [--type=block]
widget/widget.jsonchỉ tồn tại ở theme cha — không có bản theme con.
make:widget:sidebar
Tạo class widget cho sidebar trong views/<theme-cha>/widget/sidebar/<type>/<folder>/ và đăng ký vào widget/widget.json.
Arguments
- type - nhóm sidebar:
sidebar,sidebar-list,sidebar-detailREQUIRED - folder - tên thư mục widget REQUIRED
- class - tên class Optional
- file - tên file widget Optional
make:widget:sidebar [<type>] [<folder>] [<class>?] [<file>?]
Những thay đổi so với v7
| Thay đổi | Chi tiết |
|---|---|
Đã gỡ make:validate:plugin / make:validate:theme | v8 không mở rộng được custom validate rule (RuleCollection khởi tạo ValidatorFactory mới mỗi lần). Dùng Rule::make('Label')->custom(fn($v) => …) thay thế. |
| Đường dẫn đổi hoàn toàn | Các thư mục theme-custom/, <theme>/core/, <theme>/Cms/, <plugin>/core/ không còn tồn tại. Code plugin nằm ở plugins/<id>/app/, code theme nằm ở views/<theme-child>/app/. |
| Lõi không quét thư mục nữa | Tạo class mà quên đăng ký vào registry (elements.json, widget.json, plugin.json, theme-child.json) thì class không bao giờ được nạp. Các lệnh make:* đã tự ghi registry giúp. |
| Lệnh mới | builder:export, builder:import, make:element, make:controller:*, make:middleware:*, make:provider:*, make:services:*, make:supports:*, theme:child:copy, cache:lang, db:show, db:table. |
| Tên lệnh chuẩn hóa | make:ajax, make:model, make:module, make:taxonomy nay tách rõ hai biến thể :plugin / :theme (riêng make:table và make:taxonomy dùng option --plugin=). |