Console commands
Open-Admin
has several console commands built in to help with development. Once Open-Admin is installed, you can use them directly.
artisan admin
Use the php artisan admin
command to display the current version of Open-Admin
and list all available admin commands.
$ php artisan admin
____ ___ __ _
/ __ \____ ___ ____ / | ____/ /___ ___ (_)___
/ / / / __ \/ _ \/ __ \ ______ / /| |/ __ / __ `__ \/ / __ \
/ /_/ / /_/ / __/ / / / /_____/ / ___ / /_/ / / / / / / / / / /
\____/ .___/\___/_/ /_/ /_/ |_\__,_/_/ /_/ /_/_/_/ /_/
/_/
Open-Admin version 1.0
Available commands:
admin:make Make admin controller
admin:controller Make admin controller (simular to admin:make)
admin:menu Show the admin menu
admin:install Install the admin package
admin:publish re-publish Open-Admin's assets, configuration, language and migration files. If you want overwrite the existing files, you can add the `--force` option
admin:uninstall Uninstall the admin package
admin:import Import a Open-Admin extension
admin:create-user Create a admin user
admin:reset-password Reset password for a specific admin user
admin:extend Build a Open-Admin extension
admin:export-seed Export seed a Open-Admin database tables menu, roles and permissions
admin:minify Minify the CSS and JS
admin:form Make admin form widget
admin:permissions generate admin permission base on table name
admin:action Make a admin action
admin:generate-menu Generate menu items based on registered routes.
admin:config Compare the difference between the admin config file and the original
artisan admin:make
This command is used to create the admin controller, passing in a model, it will build the required code of the three grid
, form
and show
pages according to the fields of the model corresponding table.
$ php artisan admin:make \\App\\Models\\Post
//with controller name
$ php artisan admin:make \\App\\Models\\Post --name=MyPostController
// In the windows system
$ php artisan admin:make \\App\\Models\\Post
App\Admin\Controllers\PostController created successfully.
Then open app/Admin/Controllers/PostController.php
and you will see the code generated by this command.
If you add the option --output
or -O
, the code will be printed without creating a controller file.
artisan admin:install & artisan admin:uninstall
These two commands are used to install and uninstall the Open-Admin package, where admin:install
will create several files or directories in the project.
.
├── app/Admin/
├── config/admin.php
├── resources/lang/
│ └── lang/
│ ├── en/admin.php
│ └── zh-CN/admin.php
├── database/migrations/2016_01_04_173148_create_admin_tables.php
└── public/vendor/Open-Admin/
Running artisan admin:uninstall
will delete these files or directories
artisan admin:create-user
This command is used to create an admin user. After filling in the username and password interactively and selecting the role, a user can be created.
$ php artisan admin:create-user
Please enter a username to login:
>
artisan admin:reset-password
This command is used to reset the password for the specified user and operate according to the prompt of the command.
$ php artisan admin:reset-password
Please enter a username who needs to reset his password:
>
artisan admin:import
This command is used to import the relevant configuration after installing a Open-Admin extension. The specific usage is in the documentation of each extension.
artisan admin:menu
This is a no-use command to list the left menu data in json format.