diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e4dff10
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+.DS_Store
+phpunit.phar
+/vendor
+composer.phar
+composer.lock
+*.project
+.idea/
+.php_cs.cache
+.vscode/
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..51f14aa
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,22 @@
+language: php
+
+php:
+ - 7
+
+matrix:
+ fast_finish: true
+ allow_failures:
+ - php: hhvm
+
+sudo: false
+
+services:
+ - mysql
+
+before_script:
+ - mysql -e 'create database if not exists laravel_admin;'
+ - travis_retry composer self-update
+ - travis_retry composer install --no-interaction
+
+script:
+ - composer test
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..cc17429
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,67 @@
+# Contribute
+
+## Introduction
+
+First, thank you for considering contributing to laravel-admin! It's people like you that make the open source community such a great community! 😊
+
+We welcome any type of contribution, not only code. You can help with
+- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open)
+- **Marketing**: writing blog posts, howto's, printing stickers, ...
+- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
+- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
+- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/laravel-admin).
+
+## Your First Contribution
+
+Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
+
+## Submitting code
+
+Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests.
+
+## Code review process
+
+The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
+It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
+
+## Financial contributions
+
+We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/laravel-admin).
+Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
+
+## Questions
+
+If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
+You can also reach us at hello@laravel-admin.opencollective.com.
+
+## Credits
+
+### Contributors
+
+Thank you to all the people who have already contributed to laravel-admin!
+
+
+
+### Backers
+
+Thank you to all our backers! [[Become a backer](https://opencollective.com/laravel-admin#backer)]
+
+
+
+
+### Sponsors
+
+Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/laravel-admin#sponsor))
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..229071a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Jens Segers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
index d10d13c..0857bbb 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,153 @@
-# laravel-admin
+
+
+Screenshots
+------------
+
+
+
+Requirements
+------------
+ - PHP >= 7.0.0
+ - Laravel >= 5.5.0
+ - Fileinfo PHP Extension
+
+Installation
+------------
+
+> This package requires PHP 7+ and Laravel 5.5, for old versions please refer to [1.4](https://laravel-admin.org/docs/v1.4/#/)
+
+First, install laravel 5.5, and make sure that the database connection settings are correct.
+
+```
+composer require encore/laravel-admin
+```
+
+Then run these commands to publish assets and config:
+
+```
+php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
+```
+After run command you can find config file in `config/admin.php`, in this file you can change the install directory,db connection or table names.
+
+At last run following command to finish install.
+```
+php artisan admin:install
+```
+
+Open `http://localhost/admin/` in browser,use username `admin` and password `admin` to login.
+
+Configurations
+------------
+The file `config/admin.php` contains an array of configurations, you can find the default configurations in there.
+
+## Extensions
+
+| Extension | Description | laravel-admin |
+| ------------------------------------------------ | ---------------------------------------- |---------------------------------------- |
+| [helpers](https://github.com/laravel-admin-extensions/helpers) | Several tools to help you in development | ~1.5 |
+| [media-manager](https://github.com/laravel-admin-extensions/media-manager) | Provides a web interface to manage local files | ~1.5 |
+| [api-tester](https://github.com/laravel-admin-extensions/api-tester) | Help you to test the local laravel APIs |~1.5 |
+| [scheduling](https://github.com/laravel-admin-extensions/scheduling) | Scheduling task manager for laravel-admin |~1.5 |
+| [redis-manager](https://github.com/laravel-admin-extensions/redis-manager) | Redis manager for laravel-admin |~1.5 |
+| [backup](https://github.com/laravel-admin-extensions/backup) | An admin interface for managing backups |~1.5 |
+| [log-viewer](https://github.com/laravel-admin-extensions/log-viewer) | Log viewer for laravel |~1.5 |
+| [config](https://github.com/laravel-admin-extensions/config) | Config manager for laravel-admin |~1.5 |
+| [reporter](https://github.com/laravel-admin-extensions/reporter) | Provides a developer-friendly web interface to view the exception |~1.5 |
+| [wangEditor](https://github.com/laravel-admin-extensions/wangEditor) | A rich text editor based on [wangeditor](http://www.wangeditor.com/) |~1.6 |
+| [summernote](https://github.com/laravel-admin-extensions/summernote) | A rich text editor based on [summernote](https://summernote.org/) |~1.6 |
+| [china-distpicker](https://github.com/laravel-admin-extensions/china-distpicker) | 一个基于[distpicker](https://github.com/fengyuanchen/distpicker)的中国省市区选择器 |~1.6 |
+| [simplemde](https://github.com/laravel-admin-extensions/simplemde) | A markdow editor based on [simplemde](https://github.com/sparksuite/simplemde-markdown-editor) |~1.6 |
+| [phpinfo](https://github.com/laravel-admin-extensions/phpinfo) | Integrate the `phpinfo` page into laravel-admin |~1.6 |
+| [php-editor](https://github.com/laravel-admin-extensions/php-editor) [python-editor](https://github.com/laravel-admin-extensions/python-editor) [js-editor](https://github.com/laravel-admin-extensions/js-editor) [css-editor](https://github.com/laravel-admin-extensions/css-editor) [clike-editor](https://github.com/laravel-admin-extensions/clike-editor)| Several programing language editor extensions based on code-mirror |~1.6 |
+| [star-rating](https://github.com/laravel-admin-extensions/star-rating) | Star Rating extension for laravel-admin |~1.6 |
+| [json-editor](https://github.com/laravel-admin-extensions/json-editor) | JSON Editor for Laravel-admin |~1.6 |
+| [grid-lightbox](https://github.com/laravel-admin-extensions/grid-lightbox) | Turn your grid into a lightbox & gallery |~1.6 |
+| [daterangepicker](https://github.com/laravel-admin-extensions/daterangepicker) | Integrates daterangepicker into laravel-admin |~1.6 |
+| [material-ui](https://github.com/laravel-admin-extensions/material-ui) | Material-UI extension for laravel-admin |~1.6 |
+| [sparkline](https://github.com/laravel-admin-extensions/sparkline) | Integrates jQuery sparkline into laravel-admin |~1.6 |
+| [chartjs](https://github.com/laravel-admin-extensions/chartjs) | Use Chartjs in laravel-admin |~1.6 |
+| [simditor](https://github.com/laravel-admin-extensions/simditor) | Integrates simditor full-rich editor into laravel-admin |~1.6 |
+| [cropper](https://github.com/laravel-admin-extensions/cropper) | A simple jQuery image cropping plugin. |~1.6 |
+| [composer-viewer](https://github.com/laravel-admin-extensions/composer-viewer) | A web interface of composer packages in laravel. |~1.6 |
+
+
+## Contributors
+ This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
+
+ ## Backers
+ Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/laravel-admin#backer)]
+
+ ## Sponsors
+ Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/laravel-admin#sponsor)]
+
+
+
+
+
+
+
+
+
+
+
+Other
+------------
+`laravel-admin` based on following plugins or services:
+
++ [Laravel](https://laravel.com/)
++ [AdminLTE](https://almsaeedstudio.com/)
++ [Datetimepicker](http://eonasdan.github.io/bootstrap-datetimepicker/)
++ [font-awesome](http://fontawesome.io)
++ [moment](http://momentjs.com/)
++ [Google map](https://www.google.com/maps)
++ [Tencent map](http://lbs.qq.com/)
++ [bootstrap-fileinput](https://github.com/kartik-v/bootstrap-fileinput)
++ [jquery-pjax](https://github.com/defunkt/jquery-pjax)
++ [Nestable](http://dbushell.github.io/Nestable/)
++ [toastr](http://codeseven.github.io/toastr/)
++ [X-editable](http://github.com/vitalets/x-editable)
++ [bootstrap-number-input](https://github.com/wpic/bootstrap-number-input)
++ [fontawesome-iconpicker](https://github.com/itsjavi/fontawesome-iconpicker)
++ [sweetalert2](https://github.com/sweetalert2/sweetalert2)
+
+License
+------------
+`laravel-admin` is licensed under [The MIT License (MIT)](LICENSE).
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..af75438
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,64 @@
+{
+ "name": "aix/laravel-admin",
+ "description": "laravel admin",
+ "version": "1.0.1",
+ "type": "library",
+ "keywords": ["laravel", "admin", "grid", "form"],
+ "homepage": "https://github.com/z-song/laravel-admin",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "zsong",
+ "email": "zosong@126.com"
+ }
+ ],
+ "require": {
+ "php": ">=7.0.0",
+ "symfony/dom-crawler": "~3.1|~4.0",
+ "laravel/framework": "~5.5",
+ "doctrine/dbal": "2.*"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~6.0",
+ "laravel/laravel": "~5.5",
+ "symfony/css-selector": "~3.1",
+ "fzaninotto/faker": "~1.4",
+ "intervention/image": "~2.3",
+ "laravel/browser-kit-testing": "^2.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Encore\\Admin\\": "src/"
+ },
+ "files": [
+ "src/helpers.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\Models\\": "tests/models",
+ "Tests\\Controllers\\": "tests/controllers"
+ },
+ "classmap": [
+ "tests/TestCase.php"
+ ]
+ },
+ "scripts": {
+ "test": "./vendor/bin/phpunit"
+ },
+ "suggest": {
+ "intervention/image": "Required to handling and manipulation upload images (~2.3).",
+ "spatie/eloquent-sortable": "Required to built orderable gird."
+ },
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Encore\\Admin\\AdminServiceProvider"
+ ],
+ "aliases": {
+ "Admin": "Encore\\Admin\\Facades\\Admin"
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/config/admin.php b/config/admin.php
new file mode 100644
index 0000000..24fea14
--- /dev/null
+++ b/config/admin.php
@@ -0,0 +1,320 @@
+ 'Laravel-admin',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin logo
+ |--------------------------------------------------------------------------
+ |
+ | The logo of all admin pages. You can also set it as an image by using a
+ | `img` tag, eg ''.
+ |
+ */
+ 'logo' => 'Laravel admin',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin mini logo
+ |--------------------------------------------------------------------------
+ |
+ | The logo of all admin pages when the sidebar menu is collapsed. You can
+ | also set it as an image by using a `img` tag, eg
+ | ''.
+ |
+ */
+ 'logo-mini' => 'La',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin route settings
+ |--------------------------------------------------------------------------
+ |
+ | The routing configuration of the admin page, including the path prefix,
+ | the controller namespace, and the default middleware. If you want to
+ | access through the root path, just set the prefix to empty string.
+ |
+ */
+ 'route' => [
+
+ 'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),
+
+ 'namespace' => 'App\\Admin\\Controllers',
+
+ 'middleware' => ['web', 'admin'],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin install directory
+ |--------------------------------------------------------------------------
+ |
+ | The installation directory of the controller and routing configuration
+ | files of the administration page. The default is `app/Admin`, which must
+ | be set before running `artisan admin::install` to take effect.
+ |
+ */
+ 'directory' => app_path('Admin'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin html title
+ |--------------------------------------------------------------------------
+ |
+ | Html title for all pages.
+ |
+ */
+ 'title' => 'Admin',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Access via `https`
+ |--------------------------------------------------------------------------
+ |
+ | If your page is going to be accessed via https, set it to `true`.
+ |
+ */
+ 'https' => env('ADMIN_HTTPS', false),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin auth setting
+ |--------------------------------------------------------------------------
+ |
+ | Authentication settings for all admin pages. Include an authentication
+ | guard and a user provider setting of authentication driver.
+ |
+ | You can specify a controller for `login` `logout` and other auth routes.
+ |
+ */
+ 'auth' => [
+
+ 'controller' => App\Admin\Controllers\AuthController::class,
+
+ 'guards' => [
+ 'admin' => [
+ 'driver' => 'session',
+ 'provider' => 'admin',
+ ],
+ ],
+
+ 'providers' => [
+ 'admin' => [
+ 'driver' => 'eloquent',
+ 'model' => Encore\Admin\Auth\Database\Administrator::class,
+ ],
+ ],
+
+ // Add "remember me" to login form
+ 'remember' => true,
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin upload setting
+ |--------------------------------------------------------------------------
+ |
+ | File system configuration for form upload files and images, including
+ | disk and upload path.
+ |
+ */
+ 'upload' => [
+
+ // Disk in `config/filesystem.php`.
+ 'disk' => 'admin',
+
+ // Image and file upload path under the disk above.
+ 'directory' => [
+ 'image' => 'images',
+ 'file' => 'files',
+ ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Laravel-admin database settings
+ |--------------------------------------------------------------------------
+ |
+ | Here are database settings for laravel-admin builtin model & tables.
+ |
+ */
+ 'database' => [
+
+ // Database connection for following tables.
+ 'connection' => '',
+
+ // User tables and model.
+ 'users_table' => 'admin_users',
+ 'users_model' => Encore\Admin\Auth\Database\Administrator::class,
+
+ // Role table and model.
+ 'roles_table' => 'admin_roles',
+ 'roles_model' => Encore\Admin\Auth\Database\Role::class,
+
+ // Permission table and model.
+ 'permissions_table' => 'admin_permissions',
+ 'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
+
+ // Menu table and model.
+ 'menu_table' => 'admin_menu',
+ 'menu_model' => Encore\Admin\Auth\Database\Menu::class,
+
+ // Pivot table for table above.
+ 'operation_log_table' => 'admin_operation_log',
+ 'user_permissions_table' => 'admin_user_permissions',
+ 'role_users_table' => 'admin_role_users',
+ 'role_permissions_table' => 'admin_role_permissions',
+ 'role_menu_table' => 'admin_role_menu',
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | User operation log setting
+ |--------------------------------------------------------------------------
+ |
+ | By setting this option to open or close operation log in laravel-admin.
+ |
+ */
+ 'operation_log' => [
+
+ 'enable' => true,
+
+ /*
+ * Only logging allowed methods in the list
+ */
+ 'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
+
+ /*
+ * Routes that will not log to database.
+ *
+ * All method to path like: admin/auth/logs
+ * or specific method to path like: get:admin/auth/logs.
+ */
+ 'except' => [
+ 'admin/auth/logs*',
+ ],
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Admin map field provider
+ |--------------------------------------------------------------------------
+ |
+ | Supported: "tencent", "google", "yandex".
+ |
+ */
+ 'map_provider' => 'google',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application Skin
+ |--------------------------------------------------------------------------
+ |
+ | This value is the skin of admin pages.
+ | @see https://adminlte.io/docs/2.4/layout
+ |
+ | Supported:
+ | "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
+ | "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
+ | "skin-red", "skin-red-light", "skin-black", "skin-black-light".
+ |
+ */
+ 'skin' => 'skin-blue-light',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Application layout
+ |--------------------------------------------------------------------------
+ |
+ | This value is the layout of admin pages.
+ | @see https://adminlte.io/docs/2.4/layout
+ |
+ | Supported: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
+ | "sidebar-mini".
+ |
+ */
+ 'layout' => ['sidebar-mini', 'sidebar-collapse'],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Login page background image
+ |--------------------------------------------------------------------------
+ |
+ | This value is used to set the background image of login page.
+ |
+ */
+ 'login_background_image' => '',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Show version at footer
+ |--------------------------------------------------------------------------
+ |
+ | Whether to display the version number of laravel-admin at the footer of
+ | each page
+ |
+ */
+ 'show_version' => true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Show environment at footer
+ |--------------------------------------------------------------------------
+ |
+ | Whether to display the environment at the footer of each page
+ |
+ */
+ 'show_environment' => true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Menu bind to permission
+ |--------------------------------------------------------------------------
+ |
+ | whether enable menu bind to a permission
+ */
+ 'menu_bind_permission' => true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Enable default breadcrumb
+ |--------------------------------------------------------------------------
+ |
+ | Whether enable default breadcrumb for every page content.
+ */
+ 'enable_default_breadcrumb' => true,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Extension Directory
+ |--------------------------------------------------------------------------
+ |
+ | When you use command `php artisan admin:extend` to generate extensions,
+ | the extension files will be generated in this directory.
+ */
+ 'extension_dir' => app_path('Admin/Extensions'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Settings for extensions.
+ |--------------------------------------------------------------------------
+ |
+ | You can find all available extensions here
+ | https://github.com/laravel-admin-extensions.
+ |
+ */
+ 'extensions' => [
+
+ ],
+];
diff --git a/database/migrations/2016_01_04_173148_create_admin_tables.php b/database/migrations/2016_01_04_173148_create_admin_tables.php
new file mode 100644
index 0000000..8c21313
--- /dev/null
+++ b/database/migrations/2016_01_04_173148_create_admin_tables.php
@@ -0,0 +1,114 @@
+create(config('admin.database.users_table'), function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('username', 190)->unique();
+ $table->string('password', 60);
+ $table->string('name');
+ $table->string('avatar')->nullable();
+ $table->string('remember_token', 100)->nullable();
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.roles_table'), function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name', 50)->unique();
+ $table->string('slug', 50);
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.permissions_table'), function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name', 50)->unique();
+ $table->string('slug', 50);
+ $table->string('http_method')->nullable();
+ $table->text('http_path')->nullable();
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.menu_table'), function (Blueprint $table) {
+ $table->increments('id');
+ $table->integer('parent_id')->default(0);
+ $table->integer('order')->default(0);
+ $table->string('title', 50);
+ $table->string('icon', 50);
+ $table->string('uri', 50)->nullable();
+ $table->string('permission')->nullable();
+
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.role_users_table'), function (Blueprint $table) {
+ $table->integer('role_id');
+ $table->integer('user_id');
+ $table->index(['role_id', 'user_id']);
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.role_permissions_table'), function (Blueprint $table) {
+ $table->integer('role_id');
+ $table->integer('permission_id');
+ $table->index(['role_id', 'permission_id']);
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.user_permissions_table'), function (Blueprint $table) {
+ $table->integer('user_id');
+ $table->integer('permission_id');
+ $table->index(['user_id', 'permission_id']);
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.role_menu_table'), function (Blueprint $table) {
+ $table->integer('role_id');
+ $table->integer('menu_id');
+ $table->index(['role_id', 'menu_id']);
+ $table->timestamps();
+ });
+
+ Schema::connection($connection)->create(config('admin.database.operation_log_table'), function (Blueprint $table) {
+ $table->increments('id');
+ $table->integer('user_id');
+ $table->string('path');
+ $table->string('method', 10);
+ $table->string('ip');
+ $table->text('input');
+ $table->index('user_id');
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ $connection = config('admin.database.connection') ?: config('database.default');
+
+ Schema::connection($connection)->dropIfExists(config('admin.database.users_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.roles_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.permissions_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.menu_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.user_permissions_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.role_users_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.role_permissions_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.role_menu_table'));
+ Schema::connection($connection)->dropIfExists(config('admin.database.operation_log_table'));
+ }
+}
diff --git a/docs/en/LICENSE.md b/docs/en/LICENSE.md
new file mode 100644
index 0000000..229071a
--- /dev/null
+++ b/docs/en/LICENSE.md
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Jens Segers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/docs/en/README.md b/docs/en/README.md
new file mode 100644
index 0000000..699c7c5
--- /dev/null
+++ b/docs/en/README.md
@@ -0,0 +1,75 @@
+laravel-admin
+=====
+
+[](https://travis-ci.org/z-song/laravel-admin)
+[](https://styleci.io/repos/48796179)
+[](https://scrutinizer-ci.com/g/z-song/laravel-admin/?branch=master)
+[](https://packagist.org/packages/encore/laravel-admin)
+[](https://packagist.org/packages/encore/laravel-admin)
+[](https://github.com/z-song/laravel-admin)
+
+`laravel-admin` is administrative interface builder for laravel which can help you build CRUD backends just with few lines of code.
+
+[Demo](http://laravel-admin.org/demo) use `username/password:admin/admin`
+
+Inspired by [SleepingOwlAdmin](https://github.com/sleeping-owl/admin) and [rapyd-laravel](https://github.com/zofe/rapyd-laravel).
+
+[Documentation](http://laravel-admin.org/docs) | [中文文档](http://laravel-admin.org/docs/#/zh/)
+
+Screenshots
+------------
+
+
+
+Installation
+------------
+
+> This package requires PHP 7+ and Laravel 5.5, for old versions please refer to [1.4](http://laravel-admin.org/docs/v1.4/#/)
+
+First, install laravel 5.5, and make sure that the database connection settings are correct.
+
+```
+composer require encore/laravel-admin 1.5.*
+```
+
+Then run these commands to publish assets and config:
+
+```
+php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
+```
+After run command you can find config file in `config/admin.php`, in this file you can change the install directory,db connection or table names.
+
+At last run following command to finish install.
+```
+php artisan admin:install
+```
+
+Open `http://localhost/admin/` in browser,use username `admin` and password `admin` to login.
+
+Default Settings
+------------
+The file in `config/admin.php` contains an array of settings, you can find the default settings in there.
+
+
+Other
+------------
+`laravel-admin` based on following plugins or services:
+
++ [Laravel](https://laravel.com/)
++ [AdminLTE](https://almsaeedstudio.com/)
++ [Datetimepicker](http://eonasdan.github.io/bootstrap-datetimepicker/)
++ [font-awesome](http://fontawesome.io)
++ [moment](http://momentjs.com/)
++ [Google map](https://www.google.com/maps)
++ [Tencent map](http://lbs.qq.com/)
++ [bootstrap-fileinput](https://github.com/kartik-v/bootstrap-fileinput)
++ [jquery-pjax](https://github.com/defunkt/jquery-pjax)
++ [Nestable](http://dbushell.github.io/Nestable/)
++ [toastr](http://codeseven.github.io/toastr/)
++ [X-editable](http://github.com/vitalets/x-editable)
++ [bootstrap-number-input](https://github.com/wpic/bootstrap-number-input)
++ [fontawesome-iconpicker](https://github.com/itsjavi/fontawesome-iconpicker)
+
+License
+------------
+`laravel-admin` is licensed under [The MIT License (MIT)](LICENSE).
diff --git a/docs/en/_sidebar.md b/docs/en/_sidebar.md
new file mode 100644
index 0000000..16911a7
--- /dev/null
+++ b/docs/en/_sidebar.md
@@ -0,0 +1,34 @@
+
+- Getting started
+ - [Installation](/en/installation.md)
+ - [Quick start](/en/quick-start.md)
+ - [Page content & Layout](/en/content-layout.md)
+- Model grid
+ - [Basic usage](/en/model-grid.md)
+ - [Row actions](/en/model-grid-actions.md)
+ - [Column actions](/en/model-grid-column.md)
+ - [Custom tools](/en/model-grid-custom-tools.md)
+ - [Filters](/en/model-grid-filters.md)
+ - [Data export](/en/model-grid-export.md)
+- Model form
+ - [Basic usage](/en/model-form.md)
+ - [Image/File upload](/en/model-form-upload.md)
+ - [Form fields](/en/model-form-fields.md)
+ - [Form field management](/en/model-form-field-management.md)
+ - [Form validation](/en/model-form-validation.md)
+ - [Save callback](/en/model-form-callback.md)
+- [Model-tree](/en/model-tree.md)
+- Admin extensions
+ - [Helpers](/en/extension-helpers.md)
+ - [Media manager](/en/extension-media-manager.md)
+ - [API tester](/en/extension-api-tester.md)
+ - [Config manager](/en/extension-config.md)
+ - [Task scheduling](/en/extension-scheduling.md)
+- [Widgets](/en/widgets.md)
+- [Permissions](/en/permission.md)
+- [Custom authentication](/en/custom-authentication.md)
+- [Custom Navbar](/en/custom-navbar.md)
+- [Custom chart](/en/custom-chart.md)
+- [Helpers](/en/helpers.md)
+- [Upgrade precautions](/en/upgrade.md)
+- [Change log](/en/change-log.md)
\ No newline at end of file
diff --git a/docs/en/change-log.md b/docs/en/change-log.md
new file mode 100644
index 0000000..4dc24c2
--- /dev/null
+++ b/docs/en/change-log.md
@@ -0,0 +1,12 @@
+# Change log
+
+## v1.2.9、v1.3.3、v1.4.1
+
+- Add user settings and modify avatar function
+- Embedded form support
+- Support for customize navigation bar (upper right corner)
+- Add scaffolding, database command line tool, web artisan help tool
+- Support for customize login page and login logic
+- The form supports setting the width and setting the action
+- Optimize table filters
+- Fix bugs, optimize code and logic
\ No newline at end of file
diff --git a/docs/en/content-layout.md b/docs/en/content-layout.md
new file mode 100644
index 0000000..7508767
--- /dev/null
+++ b/docs/en/content-layout.md
@@ -0,0 +1,139 @@
+# Page content
+
+The layout usage of `laravel-admin` can be found in the `index()` method of the home page's layout file [HomeController.php](https://github.com/z-song/laravel-admin/blob/master/src/Console/stubs/HomeController.stub).
+
+The `Encore\Admin\Layout\Content` class is used to implement the layout of the content area. The `Content::body ($element)` method is used to add page content:
+
+The page code for an unfilled content is as follows:
+
+```php
+public function index()
+{
+ return Admin::content(function (Content $content) {
+
+ // optional
+ $content->header('page header');
+
+ // optional
+ $content->description('page description');
+
+ // add breadcrumb since v1.5.7
+ $content->breadcrumb(
+ ['text' => 'Dashboard', 'url' => '/admin'],
+ ['text' => 'User management', 'url' => '/admin/users'],
+ ['text' => 'Edit user']
+ );
+
+ // Fill the page body part, you can put any renderable objects here
+ $content->body('hello world');
+ });
+}
+```
+
+Method `$content->body();` can accepts any renderable objects, like string, number, class that has method `__toString`, or implements `Renderable`、`Htmlable` interface , include Laravel View objects.
+
+## Layout
+
+`laravel-admin` use grid system of bootstrap,The length of each line is 12, the following is a few simple examples:
+
+Add a line of content:
+
+```php
+$content->row('hello')
+
+---------------------------------
+|hello |
+| |
+| |
+| |
+| |
+| |
+---------------------------------
+
+```
+
+Add multiple columns within the line:
+
+```php
+$content->row(function(Row $row) {
+ $row->column(4, 'foo');
+ $row->column(4, 'bar');
+ $row->column(4, 'baz');
+});
+----------------------------------
+|foo |bar |baz |
+| | | |
+| | | |
+| | | |
+| | | |
+| | | |
+----------------------------------
+
+
+$content->row(function(Row $row) {
+ $row->column(4, 'foo');
+ $row->column(8, 'bar');
+});
+----------------------------------
+|foo |bar |
+| | |
+| | |
+| | |
+| | |
+| | |
+----------------------------------
+
+```
+
+Column in the column:
+
+```php
+$content->row(function (Row $row) {
+
+ $row->column(4, 'xxx');
+
+ $row->column(8, function (Column $column) {
+ $column->row('111');
+ $column->row('222');
+ $column->row('333');
+ });
+});
+----------------------------------
+|xxx |111 |
+| |---------------------|
+| |222 |
+| |---------------------|
+| |333 |
+| | |
+----------------------------------
+
+
+```
+
+
+Add rows in rows and add columns:
+
+```php
+$content->row(function (Row $row) {
+
+ $row->column(4, 'xxx');
+
+ $row->column(8, function (Column $column) {
+ $column->row('111');
+ $column->row('222');
+ $column->row(function(Row $row) {
+ $row->column(6, '444');
+ $row->column(6, '555');
+ });
+ });
+});
+----------------------------------
+|xxx |111 |
+| |---------------------|
+| |222 |
+| |---------------------|
+| |444 |555 |
+| | | |
+----------------------------------
+```
+
diff --git a/docs/en/custom-authentication.md b/docs/en/custom-authentication.md
new file mode 100644
index 0000000..5238fb7
--- /dev/null
+++ b/docs/en/custom-authentication.md
@@ -0,0 +1,111 @@
+# Custom authentication
+
+If you do not use the `laravel-admin` built-in authentication login logic, you can refer to the following way to customize the login authentication logic.
+
+First of all, you need define a `User provider`, used to obtain the user identity, such as `app/Providers/CustomUserProvider.php`:
+
+```php
+registerPolicies();
+
+ Auth::provider('custom', function ($app, array $config) {
+
+ // Return an instance of Illuminate\Contracts\Auth\UserProvider...
+ return new CustomUserProvider();
+ });
+ }
+}
+```
+
+Finally modify the configuration, open `config/admin.php`, find the `auth` part:
+
+```php
+ 'auth' => [
+ 'guards' => [
+ 'admin' => [
+ 'driver' => 'session',
+ 'provider' => 'admin',
+ ]
+ ],
+
+ // Modify the following
+ 'providers' => [
+ 'admin' => [
+ 'driver' => 'custom',
+ ]
+ ],
+ ],
+```
+This completes the logic of custom authentication.
diff --git a/docs/en/custom-chart.md b/docs/en/custom-chart.md
new file mode 100644
index 0000000..e23c79f
--- /dev/null
+++ b/docs/en/custom-chart.md
@@ -0,0 +1,78 @@
+# Custom chart
+
+`laravel-admin 1.5` has removed all the chart components. If you want to add chart components to the page, you can refer to the following process
+
+Use `chartjs` for example, first download [chartjs](http://chartjs.org/), put it under the public directory, such as in the `public/vendor/chartjs` directory
+
+Then import the component in `app/Admin/bootstrap.php`:
+```php
+use Encore\Admin\Facades\Admin;
+
+Admin::js('/vendor/chartjs/dist/Chart.min.js');
+
+```
+
+Create a new view file `resources/views/admin/charts/bar.blade.php`
+
+```php
+
+
+```
+
+And then you can introduce this chart view anywhere on the page:
+
+```php
+public function index()
+{
+ return Admin::content(function (Content $content) {
+
+ $content->header('chart');
+ $content->description('.....');
+
+ $content->body(view('admin.charts.bar'));
+ });
+}
+
+```
+
+In the above way you can introduce any chart library. multi-chart page layout, refer to [view layout] (/en/layout.md)
\ No newline at end of file
diff --git a/docs/en/custom-navbar.md b/docs/en/custom-navbar.md
new file mode 100644
index 0000000..a7a17d0
--- /dev/null
+++ b/docs/en/custom-navbar.md
@@ -0,0 +1,148 @@
+# Customize the head navigation bar
+
+Since version `1.5.6`, you can add the html element to the top navigation bar, open `app/Admin/bootstrap.php`:
+```php
+use Encore\Admin\Facades\Admin;
+
+Admin::navbar(function (\Encore\Admin\Widgets\Navbar $navbar) {
+
+ $navbar->left('html...');
+
+ $navbar->right('html...');
+
+});
+```
+
+Methods `left` and `right` are used to add content to the left and right sides of the head, the method parameters can be any object that can be rendered (objects which impletements `Htmlable`, `Renderable`, or has method `__toString()`) or strings.
+
+## Add elements to the left
+
+For example, add a search bar on the left, first create a view `resources/views/search-bar.blade.php`:
+```php
+
+
+
+```
+Then add it to the head navigation bar:
+```php
+$navbar->left(view('search-bar'));
+```
+
+## Add elements to the right
+
+You can only add the `
` tag on the right side of the navigation, such as adding some prompt icons, creating a new rendering class `app/Admin/Extensions/Nav/Links.php`
+```php
+
+
+
+ 4
+
+
+
+HTML;
+ }
+}
+```
+
+Then add it to the head navigation bar:
+```php
+$navbar->right(new \App\Admin\Extensions\Nav\Links());
+```
+
+Or use the following html to add a drop-down menu:
+```html
+
+```
+
+More components can be found here [Bootstrap](https://getbootstrap.com/)
diff --git a/docs/en/extension-api-tester.md b/docs/en/extension-api-tester.md
new file mode 100644
index 0000000..5b4b671
--- /dev/null
+++ b/docs/en/extension-api-tester.md
@@ -0,0 +1,60 @@
+# Laravel API tester
+
+`api-tester` is an API testing tool developed for `laravel` that helps you test your laravel API like `postman`.
+
+
+
+## Installation
+
+```shell
+$ composer require laravel-admin-ext/api-tester -vvv
+
+$ php artisan vendor:publish --tag=api-tester
+
+```
+And then run the following command to import menus and permissions (which can also be added manually)
+
+```shell
+$ php artisan admin:import api-tester
+```
+
+Then you can find the entry link in the admin menu, `http://localhost/admin/api-tester`.
+
+## Usage
+
+Open `routes/api.php` try to add an api:
+
+```php
+Route::get('test', function () {
+ return 'hello world';
+});
+```
+
+Open the `api-tester` page, you can see `api/test` on the left, select it and click the `Send` button to send request to the api
+
+### Login as
+
+`Login as` Fill in the user id you want to log in, you can log in as the user to request the API, add the following API:
+
+```php
+use Illuminate\Http\Request;
+
+Route::middleware('auth:api')->get('user', function (Request $request) {
+ return $request->user();
+});
+```
+Fill in the user ID in `Login as` input , then request the api and will respond with the user's model
+
+### Parameters
+
+Used to set the request parameters for api , the type can be a string or file, add the following API:
+
+```php
+use Illuminate\Http\Request;
+
+Route::get('parameters', function (Request $request) {
+ return $request->all();
+});
+```
+
+Fill in the parameters send request and you can see the results
\ No newline at end of file
diff --git a/docs/en/extension-config.md b/docs/en/extension-config.md
new file mode 100644
index 0000000..9d18b31
--- /dev/null
+++ b/docs/en/extension-config.md
@@ -0,0 +1,44 @@
+# Configuration management
+
+This tool will store the configuration data in the database
+
+
+
+## Installation
+
+```
+$ composer require laravel-admin-ext/config
+
+$ php artisan migrate
+```
+
+Open `app/Providers/AppServiceProvider.php`, and call the `Config::load()` method within the `boot` method:
+
+```php
+ Part of the function of the tool will create or delete files in the project, there may be some file or directory permissions errors, the problem needs to be resolved.
+> Another part of the database and artisan command can not be used in the web environment.
+
+## Scaffold
+
+This Tool can help you build controller, model, migrate files, and run migration files.
+access by visit `http://localhost/admin/helpers/scaffold`.
+
+Which set the migration table structure, the primary key field is automatically generated do not need to fill out.
+
+
+
+## Database command line
+
+Database command line tool for web integration,Currently supports `mysql`,` mongodb` and `redis`,access by visit `http://localhost/admin/helpers/terminal/database`.
+
+Change the database connection in the upper right corner, and then in the bottom of the input box to enter the corresponding database query and then enter, you can get the query results:
+
+
+
+The use of the database and the operation of the database is consistent, you can run the selected database support query.
+
+## Artisan command line
+
+Web version of `Laravel`'s `artisan` command line,you can run artisan commands in it,access it by visit `http://localhost/admin/helpers/terminal/artisan`.
+
+
+
+
+## Route list
+
+This tool can use more intuitive to show all the routes, including uri, http methods and middleware, and also you can query routes. access it by visit`http://localhost/admin/helpers/routes`.
+
+
\ No newline at end of file
diff --git a/docs/en/extension-media-manager.md b/docs/en/extension-media-manager.md
new file mode 100644
index 0000000..61d7ae8
--- /dev/null
+++ b/docs/en/extension-media-manager.md
@@ -0,0 +1,50 @@
+# Media manager
+
+This tool for manage local files
+
+
+
+## Installation
+
+```
+$ composer require laravel-admin-ext/media-manager -vvv
+
+$ php artisan admin:import media-manager
+```
+
+## Configuration
+
+Open `config/admin.php` specify the disk you want to manage
+
+```php
+
+ 'extensions' => [
+
+ 'media-manager' => [
+ 'disk' => 'public' // Points to the disk set in config/filesystem.php
+ ],
+ ],
+
+```
+
+`disk` is the local disk you configured in `config/filesystem.php`, visit by access `http://localhost/admin/media`.
+
+Note If you want to preview the picture in the disk, you must set the access url in the disk configuration:
+
+
+`config/filesystem.php`:
+```php
+
+ 'disks' => [
+
+ 'public' => [
+ 'driver' => 'local',
+ 'root' => storage_path('app/public'),
+ 'url' => env('APP_URL').'/storage', // set url
+ 'visibility' => 'public',
+ ],
+
+ ...
+ ]
+```
+
diff --git a/docs/en/extension-scheduling.md b/docs/en/extension-scheduling.md
new file mode 100644
index 0000000..677d057
--- /dev/null
+++ b/docs/en/extension-scheduling.md
@@ -0,0 +1,34 @@
+# Task scheduling
+
+This tool is a web interface for manage Laravel's scheduled tasks
+
+
+
+## Installation
+
+```
+$ composer require laravel-admin-ext/scheduling -vvv
+
+$ php artisan admin:import scheduling
+```
+
+Then open `http://localhost/admin/scheduling`
+
+## Add tasks
+
+Open `app/Console/Kernel.php`, try adding two scheduled tasks:
+
+```php
+class Kernel extends ConsoleKernel
+{
+ protected function schedule(Schedule $schedule)
+ {
+ $schedule->command('inspire')->everyTenMinutes();
+
+ $schedule->command('route:list')->dailyAt('02:00');
+ }
+}
+
+```
+
+And then you can see the tasks with details in the page, and you can also directly run these two tasks in the page.
diff --git a/docs/en/installation.md b/docs/en/installation.md
new file mode 100644
index 0000000..3df0c7d
--- /dev/null
+++ b/docs/en/installation.md
@@ -0,0 +1,57 @@
+# Installation
+
+> This package requires PHP 7+ and Laravel 5.5, for old versions please refer to [1.4](http://laravel-admin.org/docs/v1.4/#/)
+
+First, install laravel, and make sure that the database connection settings are correct.
+
+Then install require this package with command:
+```
+composer require encore/laravel-admin "1.5.*"
+```
+
+Publish assets and config with command:
+```
+php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
+```
+
+After runnung previous command you can find config file in `config/admin.php`, in this file you can change default install directory (```/app/Admin```), db connection or table names.
+
+At last run following command to finish install:
+```
+php artisan admin:install
+```
+
+To check that all is working, run `php artisan serve` and open `http://localhost/admin/` in browser, use username `admin` and password `admin` to login.
+
+## Generated files
+
+After the installation is complete, the following files are generated in the project directory:
+
+### Configuration file
+
+After the installation is complete, all configurations are in the `config/admin.php` file.
+
+### Admin files
+
+After install,you can find directory`app/Admin`,and then most of our develop work is under this directory.
+
+```
+app/Admin
+├── Controllers
+│ ├── ExampleController.php
+│ └── HomeController.php
+├── bootstrap.php
+└── routes.php
+```
+
+`app/Admin/routes.php` is used to define routes.
+
+`app/Admin/bootstrap.php` is bootstrapper for laravel-admin, for usage examples see comments inside it.
+
+The `app/Admin/Controllers` directory is used to store all the controllers.
+The `HomeController.php` file under this directory is used to handle home request of admin.
+The `ExampleController.php` file is a controller example.
+
+### Static assets
+
+The front-end static files are in the `/public/packages/admin` directory.
diff --git a/docs/en/model-form-callback.md b/docs/en/model-form-callback.md
new file mode 100644
index 0000000..5219ac2
--- /dev/null
+++ b/docs/en/model-form-callback.md
@@ -0,0 +1,103 @@
+# Model form callback
+
+`model-form` currently has three methods for receiving callback functions:
+
+```php
+// callback after form submission
+$form->submitted(function (Form $form) {
+ //...
+});
+
+// callback before save
+$form->saving(function (Form $form) {
+ //...
+});
+
+// callback after save
+$form->saved(function (Form $form) {
+ //...
+});
+
+```
+If required, you can add additional fields to ignore using the submitted function e.g.
+```php
+$form->submitted(function (Form $form) {
+ $form->ignore('username');
+
+});
+
+```
+The form data that is currently submitted can be retrieved from the callback parameter `$form`:
+
+```php
+$form->saving(function (Form $form) {
+
+ dump($form->username);
+
+});
+
+```
+
+Get data in model
+```php
+$form->saved(function (Form $form) {
+
+ $form->model()->id;
+
+});
+```
+
+Can redirect other urls by returning an instance of `Symfony\Component\HttpFoundation\Response` directly in the callback:
+
+```php
+$form->saving(function (Form $form) {
+
+ // returns a simple response
+ return response('xxxx');
+
+});
+
+$form->saving(function (Form $form) {
+
+ // redirect url
+ return redirect('/admin/users');
+
+});
+
+$form->saving(function (Form $form) {
+
+ // throws an exception
+ throw new \Exception('Error friends. . .');
+
+});
+
+```
+
+Return error or success information on the page:
+
+```php
+use Illuminate\Support\MessageBag;
+
+// redirect back with an error message
+$form->saving(function ($form) {
+
+ $error = new MessageBag([
+ 'title' => 'title...',
+ 'message' => 'message....',
+ ]);
+
+ return back()->with(compact('error'));
+});
+
+// redirect back with a successful message
+$form->saving(function ($form) {
+
+ $success = new MessageBag([
+ 'title' => 'title...',
+ 'message' => 'message....',
+ ]);
+
+ return back()->with(compact('success'));
+});
+
+```
diff --git a/docs/en/model-form-field-management.md b/docs/en/model-form-field-management.md
new file mode 100644
index 0000000..54b2d2d
--- /dev/null
+++ b/docs/en/model-form-field-management.md
@@ -0,0 +1,188 @@
+# Fields management
+
+
+## Remove field
+
+The built-in `map` and `editor` fields requires the front-end files via cdn, and if there are problems with the network, they can be removed in the following ways
+
+Locate the file `app/Admin/bootstrap.php`. If the file does not exist, update `laravel-admin` and create this file.
+
+```php
+
+script = <<id}"), {
+ lineNumbers: true,
+ mode: "text/x-php",
+ extraKeys: {
+ "Tab": function(cm){
+ cm.replaceSelection(" " , "end");
+ }
+ }
+});
+
+EOT;
+ return parent::render();
+
+ }
+}
+
+```
+
+>Static resources in the class can also be imported from outside, see [Editor.php](https://github.com/z-song/laravel-admin/blob/1.3/src/Form/Field/Editor.php)
+
+Create a view file `resources/views/admin/php-editor.blade.php`:
+
+```php
+
+
+
+
+
+
+
+ @include('admin::form.error')
+
+
+
+
+
+```
+
+Finally, find the file `app/Admin/bootstrap.php`, if the file does not exist, update `laravel-admin`, and then create this file, add the following code:
+
+```
+php('code');
+
+```
+
+In this way, you can add any form fields you want to add.
+
+## Integrate CKEditor
+
+Here is another example to show you how to integrate ckeditor.
+
+At first download [CKEditor](http://ckeditor.com/download), unzip to public directory, for example `public/packages/ckeditor/`.
+
+Then Write Extension class `app/Admin/Extensions/Form/CKEditor.php`:
+```php
+script = "$('textarea.{$this->getElementClass()}').ckeditor();";
+
+ return parent::render();
+ }
+}
+```
+Add blade file `resources/views/admin/ckeditor.blade.php` for view `admin.ckeditor` :
+```php
+
+
+```
+Register this extension in `app/Admin/bootstrap.php`:
+
+```php
+use Encore\Admin\Form;
+use App\Admin\Extensions\Form\CKEditor;
+
+Form::extend('ckeditor', CKEditor::class);
+```
+After this you can use ckeditor in your form:
+
+```php
+$form->ckeditor('content');
+```
diff --git a/docs/en/model-form-fields.md b/docs/en/model-form-fields.md
new file mode 100644
index 0000000..d8d5209
--- /dev/null
+++ b/docs/en/model-form-fields.md
@@ -0,0 +1,650 @@
+# Builtin form fields
+
+There are a lots of form components built into the `model-form` to help you quickly build forms.
+
+## Public methods
+
+### Set the value to save
+```php
+$form->text('title')->value('text...');
+```
+
+### Set default value
+```php
+$form->text('title')->default('text...');
+```
+
+### Set help message
+```php
+$form->text('title')->help('help...');
+```
+
+### Set attributes of field element
+```php
+$form->text('title')->attribute(['data-title' => 'title...']);
+
+$form->text('title')->attribute('data-title', 'title...');
+```
+
+### Set placeholder
+```php
+$form->text('title')->placeholder('Please input...');
+```
+
+### Model-form-tab
+
+If the form contains too many fields, will lead to form page is too long, in which case you can use the tab to separate the form:
+
+```php
+
+$form->tab('Basic info', function ($form) {
+
+ $form->text('username');
+ $form->email('email');
+
+})->tab('Profile', function ($form) {
+
+ $form->image('avatar');
+ $form->text('address');
+ $form->mobile('phone');
+
+})->tab('Jobs', function ($form) {
+
+ $form->hasMany('jobs', function () {
+ $form->text('company');
+ $form->date('start_date');
+ $form->date('end_date');
+ });
+
+ })
+
+```
+
+## Text input
+
+```php
+$form->text($column, [$label]);
+
+// Add a submission validation rule
+$form->text($column, [$label])->rules('required|min:10');
+```
+
+## Select
+```php
+$form->select($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name']);
+```
+
+If have too many options, you can load option by ajax:
+
+```php
+$form->select('user_id')->options(function ($id) {
+ $user = User::find($id);
+
+ if ($user) {
+ return [$user->id => $user->name];
+ }
+})->ajax('/admin/api/users');
+
+// using ajax and show selected item:
+
+$form->select('user_id')->options(User::class)->ajax('/admin/api/users');
+
+// or specifying the name and id
+
+$form->select('user_id')->options(User::class, 'name', 'id')->ajax('/admin/api/users');
+```
+
+Notice:if you have modified the value of the `route.prefix` in the `config/admin.php` file, this api route should be modified to `config('admin.route.prefix').'/api/users'`.
+
+The controller method for api `/admin/api/users` is:
+
+```php
+public function users(Request $request)
+{
+ $q = $request->get('q');
+
+ return User::where('name', 'like', "%$q%")->paginate(null, ['id', 'name as text']);
+}
+
+```
+
+The json returned from api `/admin/demo/options`:
+```
+{
+ "total": 4,
+ "per_page": 15,
+ "current_page": 1,
+ "last_page": 1,
+ "next_page_url": null,
+ "prev_page_url": null,
+ "from": 1,
+ "to": 3,
+ "data": [
+ {
+ "id": 9,
+ "text": "xxx"
+ },
+ {
+ "id": 21,
+ "text": "xxx"
+ },
+ {
+ "id": 42,
+ "text": "xxx"
+ },
+ {
+ "id": 48,
+ "text": "xxx"
+ }
+ ]
+}
+```
+
+### Select linkage
+
+`select` component supports one-way linkage of parent-child relationship:
+```php
+$form->select('province')->options(...)->load('city', '/api/city');
+
+$form->select('city');
+
+```
+
+Where `load('city', '/api/city');` means that, after the current select option is changed, the current option will call the api `/api/city` via the argument` q` api returns the data to fill the options for the city selection box, where api `/api/city` returns the data format that must match:
+
+```php
+[
+ {
+ "id": 1,
+ "text": "foo"
+ },
+ {
+ "id": 2,
+ "text": "bar"
+ },
+ ...
+]
+```
+The code for the controller action is as follows:
+
+```php
+public function city(Request $request)
+{
+ $provinceId = $request->get('q');
+
+ return ChinaArea::city()->where('parent_id', $provinceId)->get(['id', DB::raw('name as text')]);
+}
+```
+
+## Multiple select
+```php
+$form->multipleSelect($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name']);
+
+// using ajax and show selected items:
+
+$form->multipleSelect($column[, $label])->options(Model::class)->ajax('ajax_url');
+
+// or specifying the name and id
+
+$form->multipleSelect($column[, $label])->options(Model::class, 'name', 'id')->ajax('ajax_url');
+```
+
+You can store value of multiple select in two ways, one is `many-to-many` relation.
+
+```
+
+class Post extends Models
+{
+ public function tags()
+ {
+ return $this->belongsToMany(Tag::class);
+ }
+}
+
+$form->multipleSelect('tags')->options(Tag::all()->pluck('name', 'id'));
+
+```
+
+The second is to store the option array into a single field. If the field is a string type, it is necessary to define [accessor and Mutator](https://laravel.com/docs/5.5/eloquent-mutators) for the field.
+
+If have too many options, you can load option by ajax
+
+```php
+$form->select('user_id')->options(function ($id) {
+ $user = User::find($id);
+
+ if ($user) {
+ return [$user->id => $user->name];
+ }
+})->ajax('/admin/api/users');
+```
+
+Notice:If you have modified the value of the `route.prefix` in the `config/admin.php` file, this api route should be modified to `config('admin.route.prefix').'/api/users'`.
+
+The controller method for api `/admin/api/users` is:
+
+```php
+public function users(Request $request)
+{
+ $q = $request->get('q');
+
+ return User::where('name', 'like', "%$q%")->paginate(null, ['id', 'name as text']);
+}
+
+```
+
+The json returned from api `/admin/demo/options`:
+```
+{
+ "total": 4,
+ "per_page": 15,
+ "current_page": 1,
+ "last_page": 1,
+ "next_page_url": null,
+ "prev_page_url": null,
+ "from": 1,
+ "to": 3,
+ "data": [
+ {
+ "id": 9,
+ "text": "xxx"
+ },
+ {
+ "id": 21,
+ "text": "xxx"
+ },
+ {
+ "id": 42,
+ "text": "xxx"
+ },
+ {
+ "id": 48,
+ "text": "xxx"
+ }
+ ]
+}
+```
+
+## Listbox
+
+The usage is as same as mutipleSelect.
+
+```php
+$form->listbox($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name']);
+```
+
+## Textarea
+```php
+$form->textarea($column[, $label])->rows(10);
+```
+
+## Radio
+```php
+$form->radio($column[, $label])->options(['m' => 'Female', 'f'=> 'Male'])->default('m');
+
+$form->radio($column[, $label])->options(['m' => 'Female', 'f'=> 'Male'])->default('m')->stacked();
+```
+
+## Checkbox
+
+`checkbox` can store values in two ways, see[multiple select](#Multiple select)
+
+The `options()` method is used to set options:
+```php
+$form->checkbox($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name']);
+
+$form->checkbox($column[, $label])->options([1 => 'foo', 2 => 'bar', 'val' => 'Option name'])->stacked();
+```
+
+## Email input
+```php
+$form->email($column[, $label]);
+```
+
+## Password input
+```php
+$form->password($column[, $label]);
+```
+
+## URL input
+```php
+$form->url($column[, $label]);
+```
+
+## Ip input
+```php
+$form->ip($column[, $label]);
+```
+
+## Phone number input
+```php
+$form->mobile($column[, $label])->options(['mask' => '999 9999 9999']);
+```
+
+## Color select
+```php
+$form->color($column[, $label])->default('#ccc');
+```
+
+## Time input
+```php
+$form->time($column[, $label]);
+
+// Set the time format, more formats reference http://momentjs.com/docs/#/displaying/format/
+$form->time($column[, $label])->format('HH:mm:ss');
+```
+
+## Date input
+```php
+$form->date($column[, $label]);
+
+// Date format setting,more format please see http://momentjs.com/docs/#/displaying/format/
+$form->date($column[, $label])->format('YYYY-MM-DD');
+```
+
+## Datetime input
+```php
+$form->datetime($column[, $label]);
+
+// Set the date format, more format reference http://momentjs.com/docs/#/displaying/format/
+$form->datetime($column[, $label])->format('YYYY-MM-DD HH:mm:ss');
+```
+
+## Time range select
+`$startTime`、`$endTime`is the start and end time fields:
+```php
+$form->timeRange($startTime, $endTime, 'Time Range');
+```
+
+## Date range select
+`$startDate`、`$endDate`is the start and end date fields:
+```php
+$form->dateRange($startDate, $endDate, 'Date Range');
+```
+
+## Datetime range select
+`$startDateTime`、`$endDateTime` is the start and end datetime fields:
+```php
+$form->datetimeRange($startDateTime, $endDateTime, 'DateTime Range');
+```
+
+## Currency input
+```php
+$form->currency($column[, $label]);
+
+// set the unit symbol
+$form->currency($column[, $label])->symbol('¥');
+
+```
+
+## Number input
+```php
+$form->number($column[, $label]);
+```
+
+## Rate input
+```php
+$form->rate($column[, $label]);
+```
+
+## Image upload
+
+Before use upload field, you must complete upload configuration, see [image/file upload](/en/model-form-upload.md).
+
+You can use compression, crop, add watermarks and other methods, please refer to [[Intervention] (http://image.intervention.io/getting_started/introduction)], picture upload directory in the file `config / admin.php` `Upload.image` configuration, if the directory does not exist, you need to create the directory and open write permissions:
+```php
+$form->image($column[, $label]);
+
+// Modify the image upload path and file name
+$form->image($column[, $label])->move($dir, $name);
+
+// Crop picture
+$form->image($column[, $label])->crop(int $width, int $height, [int $x, int $y]);
+
+// Add a watermark
+$form->image($column[, $label])->insert($watermark, 'center');
+
+// add delete button
+$form->image($column[, $label])->removable();
+
+```
+
+## File upload
+
+Before use upload field, you must complete upload configuration, see [image/file upload](/en/model-form-upload.md).
+
+The file upload directory is configured in `upload.file` in the file `config/admin.php`. If the directory does not exist, it needs to be created and write-enabled.
+```php
+$form->file($column[, $label]);
+
+// Modify the file upload path and file name
+$form->file($column[, $label])->move($dir, $name);
+
+// And set the upload file type
+$form->file($column[, $label])->rules('mimes:doc,docx,xlsx');
+
+// add delete button
+$form->file($column[, $label])->removable();
+
+```
+
+## Multiple image/file upload
+
+```php
+// multiple image
+$form->multipleImage($column[, $label]);
+
+// multiple file
+$form->multipleFile($column[, $label]);
+
+// add delete button
+$form->multipleFile($column[, $label])->removable();
+```
+
+The type of data submitted from multiple image/file field is array, if you the type of column in mysql table is array, or use mongodb, then you can save the array directly,
+but if you use string type to store the array data ,you need to specify a string format, For example, if you want to use json string to store the array data, you need to define
+ a mutator for the column in model mutator, such as the field named `pictures`, define mutator:
+
+```php
+public function setPicturesAttribute($pictures)
+{
+ if (is_array($pictures)) {
+ $this->attributes['pictures'] = json_encode($pictures);
+ }
+}
+
+public function getPicturesAttribute($pictures)
+{
+ return json_decode($pictures, true);
+}
+```
+Of course, you can also specify any other format.
+
+## Map
+
+The map field refers to the network resource, and if there is a problem with the network refer to [form Component Management](/en/model-form-field-management.md) to remove the component.
+
+Used to select the latitude and longitude, `$ latitude`,` $ longitude` for the latitude and longitude field, using Tencent map when `locale` set of laravel is` zh_CN`, otherwise use Google Maps:
+```php
+$form->map($latitude, $longitude, $label);
+
+// Use Tencent map
+$form->map($latitude, $longitude, $label)->useTencentMap();
+
+// Use google map
+$form->map($latitude, $longitude, $label)->useGoogleMap();
+```
+
+## Slider
+Can be used to select the type of digital fields, such as age:
+```php
+$form->slider($column[, $label])->options(['max' => 100, 'min' => 1, 'step' => 1, 'postfix' => 'years old']);
+```
+More options please ref to https://github.com/IonDen/ion.rangeSlider#settings
+
+## Rich text editor
+
+The editor field refers to the network resource, and if there is a problem with the network refer to [form Component Management](/en/model-form-field-management.md) to remove the component.
+
+```php
+$form->editor($column[, $label]);
+```
+
+## Hidden field
+```php
+$form->hidden($column);
+```
+
+## Switch
+`On` and` off` pairs of switches with the values `1` and` 0`:
+```php
+$states = [
+ 'on' => ['value' => 1, 'text' => 'enable', 'color' => 'success'],
+ 'off' => ['value' => 0, 'text' => 'disable', 'color' => 'danger'],
+];
+
+$form->switch($column[, $label])->states($states);
+```
+
+## Display field
+Only display the fields and without any action:
+```php
+$form->display($column[, $label]);
+```
+
+## Divide
+```php
+$form->divide();
+```
+
+## Html
+insert html,the argument passed in could be objects which impletements `Htmlable`、`Renderable`, or has method `__toString()`
+```php
+$form->html('html contents');
+```
+
+## Tags
+Insert the comma (,) separated string `tags`
+```php
+$form->tags('keywords');
+```
+
+## Icon
+Select the `font-awesome` icon.
+```php
+$form->icon('icon');
+```
+
+## HasMany
+
+One-to-many built-in tables for dealing with one-to-many relationships. Here is a simple example:
+
+There are two tables are one-to-many relationship:
+
+```sql
+CREATE TABLE `demo_painters` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `bio` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE `demo_paintings` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `painter_id` int(10) unsigned NOT NULL,
+ `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `body` text COLLATE utf8_unicode_ci NOT NULL,
+ `completed_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`),
+ KEY painter_id (`painter_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+```
+
+The model of tables are:
+```php
+hasMany(Painting::class, 'painter_id');
+ }
+}
+
+belongsTo(Painter::class, 'painter_id');
+ }
+}
+```
+
+Build the form code as follows:
+```php
+$form->display('id', 'ID');
+
+$form->text('username')->rules('required');
+$form->textarea('bio')->rules('required');
+
+$form->hasMany('paintings', function (Form\NestedForm $form) {
+ $form->text('title');
+ $form->image('body');
+ $form->datetime('completed_at');
+});
+
+$form->display('created_at', 'Created At');
+$form->display('updated_at', 'Updated At');
+```
+
+## Embeds
+
+Used to handle the `JSON` type field data of `mysql` or `object` type data of `mongodb`, or the data values of multiple fields can be stored in the form of the` JSON` string in the character type of mysql
+
+Such as the `extra` column of the `JSON` or string type in the orders table, used to store data for multiple fields:
+
+```php
+class Order extends Model
+{
+ protected $casts = [
+ 'extra' => 'json',
+ ];
+}
+```
+And then use in the form:
+```php
+$form->embeds('extra', function ($form) {
+
+ $form->text('extra1')->rules('required');
+ $form->email('extra2')->rules('required');
+ $form->mobile('extra3');
+ $form->datetime('extra4');
+
+ $form->dateRange('extra5', 'extra6', 'Date range')->rules('required');
+
+});
+
+// Customize the title
+$form->embeds('extra', 'Extra', function ($form) {
+ ...
+});
+```
+
+Callback function inside the form element to create the method call and the outside is the same.
diff --git a/docs/en/model-form-upload.md b/docs/en/model-form-upload.md
new file mode 100644
index 0000000..b1e5154
--- /dev/null
+++ b/docs/en/model-form-upload.md
@@ -0,0 +1,115 @@
+# File/Image upload
+
+[model-form](/en/model-form.md) can build file and image upload field with following codes
+
+```php
+$form->file('file_column');
+$form->image('image_column');
+```
+
+### Change store path and name
+
+```php
+
+// change upload path
+$form->image('picture')->move('public/upload/image1/');
+
+// use a unique name (md5(uniqid()).extension)
+$form->image('picture')->uniqueName();
+
+// specify filename
+$form->image('picture')->name(function ($file) {
+ return 'test.'.$file->guessExtension();
+});
+
+```
+
+[model-form](/en/model-form.md) both support for local and cloud storage upload
+
+### Upload to local
+
+first add storage configuration, add a disk in `config/filesystems.php`:
+
+```php
+
+'disks' => [
+ ... ,
+
+ 'admin' => [
+ 'driver' => 'local',
+ 'root' => public_path('uploads'),
+ 'visibility' => 'public',
+ 'url' => env('APP_URL').'/uploads',
+ ],
+],
+
+```
+
+set upload path to `public/upload`(public_path('upload')).
+
+And then in `config/admin.php` select the `disk` set up above:
+
+```php
+
+'upload' => [
+
+ 'disk' => 'admin',
+
+ 'directory' => [
+ 'image' => 'image',
+ 'file' => 'file',
+ ],
+],
+
+```
+
+Set `disk` to the` admin` that you added above,`directory.image` and `directory.file` is the upload path for `$form->image($column)` and `$form->file($column)`.
+
+`host` is url prefix for your uploaded files.
+
+
+### Upload to cloud
+
+If you need to upload to the cloud storage, need to install a driver which supports `flysystem` adapter, take `qiniu` cloud storage as example.
+
+first install [zgldh/qiniu-laravel-storage](https://github.com/zgldh/qiniu-laravel-storage).
+
+Also configure the disk, in the `config/filesystems.php` add an item:
+
+```php
+'disks' => [
+ ... ,
+ 'qiniu' => [
+ 'driver' => 'qiniu',
+ 'domains' => [
+ 'default' => 'xxxxx.com1.z0.glb.clouddn.com',
+ 'https' => 'dn-yourdomain.qbox.me',
+ 'custom' => 'static.abc.com',
+ ],
+ 'access_key'=> '', //AccessKey
+ 'secret_key'=> '', //SecretKey
+ 'bucket' => '', //Bucket
+ 'notify_url'=> '', //
+ 'url' => 'http://of8kfibjo.bkt.clouddn.com/',
+ ],
+],
+
+```
+
+Then modify the upload configuration of `laravel-admin` and open `config/admin.php` to find:
+
+```php
+
+'upload' => [
+
+ 'disk' => 'qiniu',
+
+ 'directory' => [
+ 'image' => 'image',
+ 'file' => 'file',
+ ],
+],
+
+```
+
+Select the above configuration` qiniu` for `disk`
\ No newline at end of file
diff --git a/docs/en/model-form-validation.md b/docs/en/model-form-validation.md
new file mode 100644
index 0000000..955a0a2
--- /dev/null
+++ b/docs/en/model-form-validation.md
@@ -0,0 +1,36 @@
+Form validation
+========
+
+`model-form` uses laravel's validation rules to verify the data submitted by the form:
+
+```php
+$form->text('title')->rules('required|min:3');
+
+// Complex validation rules can be implemented in the callback
+$form->text('title')->rules(function ($form) {
+
+ // If it is not an edit state, add field unique verification
+ if (!$id = $form->model()->id) {
+ return 'unique:users,email_address';
+ }
+
+});
+
+```
+
+You can also customize the error message for the validation rule:
+
+```php
+$form->text('code')->rules('required|regex:/^\d+$/|min:10', [
+ 'regex' => 'code must be numbers',
+ 'min' => 'code can not be less than 10 characters',
+]);
+```
+
+If you want to allow the field to be empty, first in the database table to face the field set to `NULL`, and then
+
+```php
+$form->text('title')->rules('nullable');
+```
+
+Please refer to the more rules [Validation](https://laravel.com/docs/5.5/validation).
\ No newline at end of file
diff --git a/docs/en/model-form.md b/docs/en/model-form.md
new file mode 100644
index 0000000..8456e0c
--- /dev/null
+++ b/docs/en/model-form.md
@@ -0,0 +1,179 @@
+# Model-Form
+
+The `Encore\Admin\Form` class is used to generate a data model-based form. For example, there is a` movies` table in the database
+
+```sql
+CREATE TABLE `movies` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `director` int(10) unsigned NOT NULL,
+ `describe` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+ `rate` tinyint unsigned NOT NULL,
+ `released` enum(0, 1),
+ `release_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ `updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+```
+
+The corresponding data model is `App\Models\Movie`, and the following code can generate the` movies` data form:
+
+```php
+
+use App\Models\Movie;
+use Encore\Admin\Form;
+use Encore\Admin\Facades\Admin;
+
+$grid = Admin::form(Movie::class, function(Form $grid){
+
+ // Displays the record id
+ $form->display('id', 'ID');
+
+ // Add an input box of type text
+ $form->text('title', 'Movie title');
+
+ $directors = [
+ 1 => 'John',
+ 2 => 'Smith',
+ 3 => 'Kate',
+ ];
+
+ $form->select('director', 'Director')->options($directors);
+
+ // Add textarea for the describe field
+ $form->textarea('describe', 'Describe');
+
+ // Number input
+ $form->number('rate', 'Rate');
+
+ // Add a switch field
+ $form->switch('released', 'Released?');
+
+ // Add a date and time selection box
+ $form->dateTime('release_at', 'release time');
+
+ // Display two time column
+ $form->display('created_at', 'Created time');
+ $form->display('updated_at', 'Updated time');
+});
+
+```
+
+## Custom tools
+
+The top right corner of the form has two button tools by default. You can modify it in the following way:
+
+```php
+$form->tools(function (Form\Tools $tools) {
+
+ // Disable back btn.
+ $tools->disableBackButton();
+
+ // Disable list btn
+ $tools->disableListButton();
+
+ // Add a button, the argument can be a string, or an instance of the object that implements the Renderable or Htmlable interface
+ $tools->add(' delete');
+});
+```
+
+## Other methods
+
+Disable submit btn:
+
+```php
+$form->disableSubmit();
+```
+
+Disable reset btn:
+```php
+$form->disableReset();
+```
+
+Ignore fields to store
+```php
+$form->ignore('column1', 'column2', 'column3');
+```
+
+Set width for label and field
+
+```php
+$form->setWidth(10, 2);
+```
+
+Set form action
+
+```php
+$form->setAction('admin/users');
+```
+
+## Model relationship
+
+
+### One to One
+The `users` table and the `profiles` table are generated one-to-one relation through the `profiles.user_id` field.
+
+```sql
+
+CREATE TABLE `users` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+CREATE TABLE `profiles` (
+`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+`user_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+`age` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+`gender` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
+`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+```
+
+The corresponding data model are:
+
+```php
+
+class User extends Model
+{
+ public function profile()
+ {
+ return $this->hasOne(Profile::class);
+ }
+}
+
+class Profile extends Model
+{
+ public function user()
+ {
+ return $this->belongsTo(User::class);
+ }
+}
+
+```
+
+You can associate them in a form with the following code:
+
+```php
+Admin::form(User::class, function (Form $form) {
+
+ $form->display('id');
+
+ $form->text('name');
+ $form->text('email');
+
+ $form->text('profile.age');
+ $form->text('profile.gender');
+
+ $form->datetime('created_at');
+ $form->datetime('updated_at');
+});
+
+```
diff --git a/docs/en/model-grid-actions.md b/docs/en/model-grid-actions.md
new file mode 100644
index 0000000..9f182f5
--- /dev/null
+++ b/docs/en/model-grid-actions.md
@@ -0,0 +1,105 @@
+# Model grid row actions
+
+`model-grid` By default, there are two actions `edit` and `delete`, which can be turned off in the following way:
+
+```php
+ $grid->actions(function ($actions) {
+ $actions->disableDelete();
+ $actions->disableEdit();
+});
+```
+You can get the data for the current row by `$actions` parameter passed in:
+```php
+ $grid->actions(function ($actions) {
+
+ // the array of data for the current row
+ $actions->row;
+
+ // gets the current row primary key value
+ $actions->getKey();
+});
+```
+
+If you have a custom action button, you can add the following:
+
+```php
+$grid->actions(function ($actions) {
+
+ // append an action.
+ $actions->append('');
+
+ // prepend an action.
+ $actions->prepend('');
+}
+```
+
+If you have more complex actions, you can refer to the following ways:
+
+First define the action class:
+```php
+id = $id;
+ }
+
+ protected function script()
+ {
+ return <<
+```
+
+然后就可以在页面的任何地方引入这个图表视图了:
+
+```php
+public function index()
+{
+ return Admin::content(function (Content $content) {
+
+ $content->header('chart');
+ $content->description('.....');
+
+ $content->body(view('admin.charts.bar'));
+ });
+}
+
+```
+
+按照上面的方式可以引入任意图表库,多图表页面的布局,参考[视图布局](/zh/layout.md)
\ No newline at end of file
diff --git a/docs/zh/custom-navbar.md b/docs/zh/custom-navbar.md
new file mode 100644
index 0000000..8f5fdf6
--- /dev/null
+++ b/docs/zh/custom-navbar.md
@@ -0,0 +1,148 @@
+# 自定义头部导航条
+
+从版本`1.5.6`开始,可以在顶部导航条上添加html元素了, 打开`app/Admin/bootstrap.php`:
+```php
+use Encore\Admin\Facades\Admin;
+
+Admin::navbar(function (\Encore\Admin\Widgets\Navbar $navbar) {
+
+ $navbar->left('html...');
+
+ $navbar->right('html...');
+
+});
+```
+
+`left`和`right`方法分别用来在头部的左右两边添加内容,方法参数可以是任何可以渲染的对象(实现了`Htmlable`、`Renderable`接口或者包含`__toString()`方法的对象)或字符串
+
+## 左侧添加示例
+
+举个例子,比如在左边添加一个搜索条,先创建一个blade视图`resources/views/search-bar.blade.php`:
+```php
+
+
+
+```
+然后加入头部导航条:
+```php
+$navbar->left(view('search-bar'));
+```
+
+## 右侧添加示例
+
+导航右侧只能添加`
\ No newline at end of file
diff --git a/resources/views/form/hasmanytab.blade.php b/resources/views/form/hasmanytab.blade.php
new file mode 100644
index 0000000..33f30ad
--- /dev/null
+++ b/resources/views/form/hasmanytab.blade.php
@@ -0,0 +1,62 @@
+
+
\ No newline at end of file
diff --git a/resources/views/form/hasmanytable.blade.php b/resources/views/form/hasmanytable.blade.php
new file mode 100644
index 0000000..4befd7a
--- /dev/null
+++ b/resources/views/form/hasmanytable.blade.php
@@ -0,0 +1,75 @@
+
+
+
+
+
diff --git a/resources/views/form/help-block.blade.php b/resources/views/form/help-block.blade.php
new file mode 100644
index 0000000..6678835
--- /dev/null
+++ b/resources/views/form/help-block.blade.php
@@ -0,0 +1,5 @@
+@if($help)
+
+ {!! array_get($help, 'text') !!}
+
+@endif
\ No newline at end of file
diff --git a/resources/views/form/hidden.blade.php b/resources/views/form/hidden.blade.php
new file mode 100644
index 0000000..97641d2
--- /dev/null
+++ b/resources/views/form/hidden.blade.php
@@ -0,0 +1 @@
+
diff --git a/resources/views/form/id.blade.php b/resources/views/form/id.blade.php
new file mode 100644
index 0000000..d6ccfe7
--- /dev/null
+++ b/resources/views/form/id.blade.php
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+ @include('admin::form.help-block')
+
+
+
\ No newline at end of file
diff --git a/resources/views/form/input.blade.php b/resources/views/form/input.blade.php
new file mode 100644
index 0000000..c5c229d
--- /dev/null
+++ b/resources/views/form/input.blade.php
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/resources/views/form/listbox.blade.php b/resources/views/form/listbox.blade.php
new file mode 100644
index 0000000..4969629
--- /dev/null
+++ b/resources/views/form/listbox.blade.php
@@ -0,0 +1,19 @@
+
diff --git a/resources/views/form/rate.blade.php b/resources/views/form/rate.blade.php
new file mode 100644
index 0000000..6a4f983
--- /dev/null
+++ b/resources/views/form/rate.blade.php
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ @include('admin::form.error')
+
+
+
+ %
+
+
+ @include('admin::form.help-block')
+
+
+
diff --git a/resources/views/form/row.blade.php b/resources/views/form/row.blade.php
new file mode 100644
index 0000000..282d042
--- /dev/null
+++ b/resources/views/form/row.blade.php
@@ -0,0 +1,7 @@
+
+ @foreach($fields as $field)
+
+ {!! $field['element']->render() !!}
+
+ @endforeach
+
\ No newline at end of file
diff --git a/resources/views/form/select.blade.php b/resources/views/form/select.blade.php
new file mode 100644
index 0000000..dc60058
--- /dev/null
+++ b/resources/views/form/select.blade.php
@@ -0,0 +1,31 @@
+
\ No newline at end of file
diff --git a/resources/views/form/tags.blade.php b/resources/views/form/tags.blade.php
new file mode 100644
index 0000000..25f7b7e
--- /dev/null
+++ b/resources/views/form/tags.blade.php
@@ -0,0 +1,21 @@
+
+@endif
\ No newline at end of file
diff --git a/resources/views/grid/displayer/table.blade.php b/resources/views/grid/displayer/table.blade.php
new file mode 100644
index 0000000..eb1fe7a
--- /dev/null
+++ b/resources/views/grid/displayer/table.blade.php
@@ -0,0 +1,18 @@
+
+
+
+ @foreach($titles as $column => $title)
+
{{ $title }}
+ @endforeach
+
+
+
+ @foreach($data as $datum)
+
+ @foreach($datum as $key => $value)
+
{{ $value }}
+ @endforeach
+
+ @endforeach
+
+
\ No newline at end of file
diff --git a/resources/views/grid/image.blade.php b/resources/views/grid/image.blade.php
new file mode 100644
index 0000000..664b505
--- /dev/null
+++ b/resources/views/grid/image.blade.php
@@ -0,0 +1,51 @@
+
\ No newline at end of file
diff --git a/resources/views/grid/table.blade.php b/resources/views/grid/table.blade.php
new file mode 100644
index 0000000..c49ee3e
--- /dev/null
+++ b/resources/views/grid/table.blade.php
@@ -0,0 +1,59 @@
+
+@endif
\ No newline at end of file
diff --git a/resources/views/partials/css.blade.php b/resources/views/partials/css.blade.php
new file mode 100644
index 0000000..6df8e7f
--- /dev/null
+++ b/resources/views/partials/css.blade.php
@@ -0,0 +1,3 @@
+@foreach($css as $c)
+
+@endforeach
\ No newline at end of file
diff --git a/resources/views/partials/exception.blade.php b/resources/views/partials/exception.blade.php
new file mode 100644
index 0000000..bb293fd
--- /dev/null
+++ b/resources/views/partials/exception.blade.php
@@ -0,0 +1,12 @@
+@if($errors->hasBag('exception') && env('APP_DEBUG') == true)
+ getBag('exception');?>
+
+
+
+
+ {{ class_basename($error->get('type')[0]) }}
+ In {{ basename($error->get('file')[0]) }} line {{ $error->get('line')[0] }} :
+
+
{!! $error->get('message')[0] !!}
+
+@endif
diff --git a/resources/views/partials/footer.blade.php b/resources/views/partials/footer.blade.php
new file mode 100644
index 0000000..070132a
--- /dev/null
+++ b/resources/views/partials/footer.blade.php
@@ -0,0 +1,18 @@
+
+
\ No newline at end of file
diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php
new file mode 100644
index 0000000..66e36d3
--- /dev/null
+++ b/resources/views/partials/header.blade.php
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+ {!! '' !!}
+
+ {!! '' !!}
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/views/partials/js.blade.php b/resources/views/partials/js.blade.php
new file mode 100644
index 0000000..0c104e9
--- /dev/null
+++ b/resources/views/partials/js.blade.php
@@ -0,0 +1,3 @@
+@foreach($js as $j)
+
+@endforeach
\ No newline at end of file
diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php
new file mode 100644
index 0000000..6696bf5
--- /dev/null
+++ b/resources/views/partials/menu.blade.php
@@ -0,0 +1,41 @@
+@if((!isset($item['status']) || $item['status'] == 1) && Admin::user()->canVisitMenu($item['id']) )
+ @if(!isset($item['children']))
+
\ No newline at end of file
diff --git a/resources/views/show/field.blade.php b/resources/views/show/field.blade.php
new file mode 100644
index 0000000..43dc4fc
--- /dev/null
+++ b/resources/views/show/field.blade.php
@@ -0,0 +1,23 @@
+
\ No newline at end of file
diff --git a/resources/views/show/panel.blade.php b/resources/views/show/panel.blade.php
new file mode 100644
index 0000000..f6ed686
--- /dev/null
+++ b/resources/views/show/panel.blade.php
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/resources/views/tree.blade.php b/resources/views/tree.blade.php
new file mode 100644
index 0000000..99d444e
--- /dev/null
+++ b/resources/views/tree.blade.php
@@ -0,0 +1,46 @@
+
\ No newline at end of file
diff --git a/resources/views/widgets/alert.blade.php b/resources/views/widgets/alert.blade.php
new file mode 100644
index 0000000..cabd331
--- /dev/null
+++ b/resources/views/widgets/alert.blade.php
@@ -0,0 +1,5 @@
+
+
+
{{ $title }}
+ {!! $content !!}
+
\ No newline at end of file
diff --git a/resources/views/widgets/box.blade.php b/resources/views/widgets/box.blade.php
new file mode 100644
index 0000000..81890bb
--- /dev/null
+++ b/resources/views/widgets/box.blade.php
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/resources/views/widgets/callout.blade.php b/resources/views/widgets/callout.blade.php
new file mode 100644
index 0000000..1d83bbe
--- /dev/null
+++ b/resources/views/widgets/callout.blade.php
@@ -0,0 +1,6 @@
+
+ @if(isset($title))
+
{{ $title }}
+ @endif
+ {!! $content !!}
+
\ No newline at end of file
diff --git a/resources/views/widgets/carousel.blade.php b/resources/views/widgets/carousel.blade.php
new file mode 100644
index 0000000..d134464
--- /dev/null
+++ b/resources/views/widgets/carousel.blade.php
@@ -0,0 +1,27 @@
+
\ No newline at end of file
diff --git a/resources/views/widgets/tab.blade.php b/resources/views/widgets/tab.blade.php
new file mode 100644
index 0000000..baa7f08
--- /dev/null
+++ b/resources/views/widgets/tab.blade.php
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/resources/views/widgets/table.blade.php b/resources/views/widgets/table.blade.php
new file mode 100644
index 0000000..459bf2c
--- /dev/null
+++ b/resources/views/widgets/table.blade.php
@@ -0,0 +1,18 @@
+