├── public ├── favicon.ico ├── uploads │ └── .gitignore ├── robots.txt ├── layui │ ├── font │ │ ├── iconfont.eot │ │ ├── iconfont.ttf │ │ └── iconfont.woff │ ├── images │ │ └── face │ │ │ ├── 0.gif │ │ │ ├── 1.gif │ │ │ ├── 2.gif │ │ │ ├── 3.gif │ │ │ ├── 4.gif │ │ │ ├── 5.gif │ │ │ ├── 6.gif │ │ │ ├── 7.gif │ │ │ ├── 8.gif │ │ │ ├── 9.gif │ │ │ ├── 10.gif │ │ │ ├── 11.gif │ │ │ ├── 12.gif │ │ │ ├── 13.gif │ │ │ ├── 14.gif │ │ │ ├── 15.gif │ │ │ ├── 16.gif │ │ │ ├── 17.gif │ │ │ ├── 18.gif │ │ │ ├── 19.gif │ │ │ ├── 20.gif │ │ │ ├── 21.gif │ │ │ ├── 22.gif │ │ │ ├── 23.gif │ │ │ ├── 24.gif │ │ │ ├── 25.gif │ │ │ ├── 26.gif │ │ │ ├── 27.gif │ │ │ ├── 28.gif │ │ │ ├── 29.gif │ │ │ ├── 30.gif │ │ │ ├── 31.gif │ │ │ ├── 32.gif │ │ │ ├── 33.gif │ │ │ ├── 34.gif │ │ │ ├── 35.gif │ │ │ ├── 36.gif │ │ │ ├── 37.gif │ │ │ ├── 38.gif │ │ │ ├── 39.gif │ │ │ ├── 40.gif │ │ │ ├── 41.gif │ │ │ ├── 42.gif │ │ │ ├── 43.gif │ │ │ ├── 44.gif │ │ │ ├── 45.gif │ │ │ ├── 46.gif │ │ │ ├── 47.gif │ │ │ ├── 48.gif │ │ │ ├── 49.gif │ │ │ ├── 50.gif │ │ │ ├── 51.gif │ │ │ ├── 52.gif │ │ │ ├── 53.gif │ │ │ ├── 54.gif │ │ │ ├── 55.gif │ │ │ ├── 56.gif │ │ │ ├── 57.gif │ │ │ ├── 58.gif │ │ │ ├── 59.gif │ │ │ ├── 60.gif │ │ │ ├── 61.gif │ │ │ ├── 62.gif │ │ │ ├── 63.gif │ │ │ ├── 64.gif │ │ │ ├── 65.gif │ │ │ ├── 66.gif │ │ │ ├── 67.gif │ │ │ ├── 68.gif │ │ │ ├── 69.gif │ │ │ ├── 70.gif │ │ │ └── 71.gif │ ├── css │ │ └── modules │ │ │ ├── layer │ │ │ └── default │ │ │ │ ├── icon.png │ │ │ │ ├── icon-ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ └── loading-2.gif │ │ │ └── code.css │ ├── lay │ │ └── modules │ │ │ ├── code.js │ │ │ ├── laytpl.js │ │ │ ├── flow.js │ │ │ ├── util.js │ │ │ ├── tree.js │ │ │ ├── carousel.js │ │ │ ├── laypage.js │ │ │ └── upload.js │ └── layui.js ├── .htaccess ├── web.config ├── index.php └── js │ ├── config.js │ ├── permissions.js │ ├── roles.js │ ├── index.js │ └── users.js ├── database ├── .gitignore ├── factories │ ├── ConfigFactory.php │ └── UserFactory.php ├── seeds │ ├── DatabaseSeeder.php │ ├── ConfigsTableSeeder.php │ └── UsersTableSeeder.php └── migrations │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2017_12_16_143338_create_configs_table.php │ ├── 2017_12_16_200551_seed_roles_and_permissions_data.php │ └── 2017_12_16_195058_create_permission_tables.php ├── bootstrap ├── cache │ └── .gitignore ├── helpers.php └── app.php ├── storage ├── debugbar │ └── .gitignore ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── cache │ └── .gitignore │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── config ├── config.php ├── view.php ├── services.php ├── broadcasting.php ├── filesystems.php ├── queue.php ├── cache.php ├── permission.php ├── auth.php ├── database.php └── mail.php ├── resources ├── views │ ├── admin │ │ ├── layouts │ │ │ ├── _style.blade.php │ │ │ ├── _footer.blade.php │ │ │ ├── app.blade.php │ │ │ ├── _header.blade.php │ │ │ ├── _sidebar.blade.php │ │ │ └── index.blade.php │ │ ├── permissions │ │ │ ├── index.blade.php │ │ │ └── create_and_edit.blade.php │ │ ├── roles │ │ │ ├── index.blade.php │ │ │ └── create_and_edit.blade.php │ │ ├── users │ │ │ ├── index.blade.php │ │ │ └── create_and_edit.blade.php │ │ └── config │ │ │ └── index.blade.php │ ├── home.blade.php │ ├── auth │ │ ├── passwords │ │ │ ├── email.blade.php │ │ │ └── reset.blade.php │ │ ├── login.blade.php │ │ └── register.blade.php │ ├── welcome.blade.php │ └── layouts │ │ └── app.blade.php ├── assets │ ├── sass │ │ ├── app.scss │ │ └── _variables.scss │ └── js │ │ ├── components │ │ └── ExampleComponent.vue │ │ ├── app.js │ │ └── bootstrap.js └── lang │ └── en │ ├── pagination.php │ ├── auth.php │ └── passwords.php ├── .gitattributes ├── .gitignore ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── app ├── Models │ ├── Config.php │ └── User.php ├── Observers │ └── UserObserver.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── TrimStrings.php │ │ ├── VerifyCsrfToken.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrustProxies.php │ │ └── CheckForMaintenanceMode.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── HomeController.php │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── RegisterController.php │ │ └── Admin │ │ │ ├── ConfigController.php │ │ │ ├── PermissionController.php │ │ │ ├── UsersController.php │ │ │ ├── RolesController.php │ │ │ └── IndexController.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Console │ └── Kernel.php └── Exceptions │ └── Handler.php ├── routes ├── channels.php ├── api.php ├── console.php └── web.php ├── webpack.mix.js ├── server.php ├── .env.example ├── readme.md ├── phpunit.xml ├── package.json ├── composer.json └── artisan /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /public/uploads/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/1.png -------------------------------------------------------------------------------- /2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/2.png -------------------------------------------------------------------------------- /3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/3.png -------------------------------------------------------------------------------- /4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/4.png -------------------------------------------------------------------------------- /config/config.php: -------------------------------------------------------------------------------- 1 | env('LIMIT', 5), 5 | ]; -------------------------------------------------------------------------------- /resources/views/admin/layouts/_style.blade.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /public/layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/font/iconfont.eot -------------------------------------------------------------------------------- /public/layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /public/layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/0.gif -------------------------------------------------------------------------------- /public/layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/1.gif -------------------------------------------------------------------------------- /public/layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/2.gif -------------------------------------------------------------------------------- /public/layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/3.gif -------------------------------------------------------------------------------- /public/layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/4.gif -------------------------------------------------------------------------------- /public/layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/5.gif -------------------------------------------------------------------------------- /public/layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/6.gif -------------------------------------------------------------------------------- /public/layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/7.gif -------------------------------------------------------------------------------- /public/layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/8.gif -------------------------------------------------------------------------------- /public/layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/9.gif -------------------------------------------------------------------------------- /public/layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/font/iconfont.woff -------------------------------------------------------------------------------- /public/layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/10.gif -------------------------------------------------------------------------------- /public/layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/11.gif -------------------------------------------------------------------------------- /public/layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/12.gif -------------------------------------------------------------------------------- /public/layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/13.gif -------------------------------------------------------------------------------- /public/layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/14.gif -------------------------------------------------------------------------------- /public/layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/15.gif -------------------------------------------------------------------------------- /public/layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/16.gif -------------------------------------------------------------------------------- /public/layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/17.gif -------------------------------------------------------------------------------- /public/layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/18.gif -------------------------------------------------------------------------------- /public/layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/19.gif -------------------------------------------------------------------------------- /public/layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/20.gif -------------------------------------------------------------------------------- /public/layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/21.gif -------------------------------------------------------------------------------- /public/layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/22.gif -------------------------------------------------------------------------------- /public/layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/23.gif -------------------------------------------------------------------------------- /public/layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/24.gif -------------------------------------------------------------------------------- /public/layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/25.gif -------------------------------------------------------------------------------- /public/layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/26.gif -------------------------------------------------------------------------------- /public/layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/27.gif -------------------------------------------------------------------------------- /public/layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/28.gif -------------------------------------------------------------------------------- /public/layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/29.gif -------------------------------------------------------------------------------- /public/layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/30.gif -------------------------------------------------------------------------------- /public/layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/31.gif -------------------------------------------------------------------------------- /public/layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/32.gif -------------------------------------------------------------------------------- /public/layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/33.gif -------------------------------------------------------------------------------- /public/layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/34.gif -------------------------------------------------------------------------------- /public/layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/35.gif -------------------------------------------------------------------------------- /public/layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/36.gif -------------------------------------------------------------------------------- /public/layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/37.gif -------------------------------------------------------------------------------- /public/layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/38.gif -------------------------------------------------------------------------------- /public/layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/39.gif -------------------------------------------------------------------------------- /public/layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/40.gif -------------------------------------------------------------------------------- /public/layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/41.gif -------------------------------------------------------------------------------- /public/layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/42.gif -------------------------------------------------------------------------------- /public/layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/43.gif -------------------------------------------------------------------------------- /public/layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/44.gif -------------------------------------------------------------------------------- /public/layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/45.gif -------------------------------------------------------------------------------- /public/layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/46.gif -------------------------------------------------------------------------------- /public/layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/47.gif -------------------------------------------------------------------------------- /public/layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/48.gif -------------------------------------------------------------------------------- /public/layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/49.gif -------------------------------------------------------------------------------- /public/layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/50.gif -------------------------------------------------------------------------------- /public/layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/51.gif -------------------------------------------------------------------------------- /public/layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/52.gif -------------------------------------------------------------------------------- /public/layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/53.gif -------------------------------------------------------------------------------- /public/layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/54.gif -------------------------------------------------------------------------------- /public/layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/55.gif -------------------------------------------------------------------------------- /public/layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/56.gif -------------------------------------------------------------------------------- /public/layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/57.gif -------------------------------------------------------------------------------- /public/layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/58.gif -------------------------------------------------------------------------------- /public/layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/59.gif -------------------------------------------------------------------------------- /public/layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/60.gif -------------------------------------------------------------------------------- /public/layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/61.gif -------------------------------------------------------------------------------- /public/layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/62.gif -------------------------------------------------------------------------------- /public/layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/63.gif -------------------------------------------------------------------------------- /public/layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/64.gif -------------------------------------------------------------------------------- /public/layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/65.gif -------------------------------------------------------------------------------- /public/layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/66.gif -------------------------------------------------------------------------------- /public/layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/67.gif -------------------------------------------------------------------------------- /public/layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/68.gif -------------------------------------------------------------------------------- /public/layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/69.gif -------------------------------------------------------------------------------- /public/layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/70.gif -------------------------------------------------------------------------------- /public/layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/images/face/71.gif -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /public/layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /public/layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /public/layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /public/layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /public/layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jourdon/laravel_admin_layui/HEAD/public/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /resources/views/admin/layouts/_footer.blade.php: -------------------------------------------------------------------------------- 1 | 2 | ©jourdon基于Laravel + Layui制作 - 底部固定区域 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | /.idea 7 | /.vagrant 8 | Homestead.json 9 | Homestead.yaml 10 | npm-debug.log 11 | yarn-error.log 12 | .env 13 | -------------------------------------------------------------------------------- /database/factories/ConfigFactory.php: -------------------------------------------------------------------------------- 1 | define(App\Models\Config::class, function (Faker $faker) { 6 | return [ 7 | 8 | ]; 9 | }); 10 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | $this->call(ConfigsTableSeeder::class); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /database/seeds/ConfigsTableSeeder.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /app/Http/Controllers/HomeController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 17 | } 18 | 19 | /** 20 | * Show the application dashboard. 21 | * 22 | * @return \Illuminate\Http\Response 23 | */ 24 | public function index() 25 | { 26 | return view('home'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 17 | return $request->user(); 18 | }); 19 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | let mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/assets/js/app.js', 'public/js') 15 | .sass('resources/assets/sass/app.scss', 'public/css'); 16 | -------------------------------------------------------------------------------- /resources/views/admin/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | @yield('title','Laravel-admin') 7 | 8 | @yield('styles') 9 | 10 | 11 |
12 | 13 | @yield('body') 14 | 15 |
16 | 17 | @yield('scripts') 18 | 19 | 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 21 | return redirect('/home'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /database/seeds/UsersTableSeeder.php: -------------------------------------------------------------------------------- 1 | times(20)->make(); 17 | User::insert($users->makeVisible(['password', 'remember_token'])->toArray()); 18 | // 单独处理第一个用户的数据 19 | $user = User::find(1); 20 | $user->name = 'Admin'; 21 | $user->email = 'admin@admin.com'; 22 | $user->save(); 23 | $user->assignRole('Administrator'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Handle Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /resources/assets/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_LOG_LEVEL=debug 6 | APP_URL=http://localhost 7 | 8 | DB_CONNECTION=mysql 9 | DB_HOST=127.0.0.1 10 | DB_PORT=3306 11 | DB_DATABASE=homestead 12 | DB_USERNAME=homestead 13 | DB_PASSWORD=secret 14 | 15 | BROADCAST_DRIVER=log 16 | CACHE_DRIVER=file 17 | SESSION_DRIVER=file 18 | SESSION_LIFETIME=120 19 | QUEUE_DRIVER=sync 20 | 21 | REDIS_HOST=127.0.0.1 22 | REDIS_PASSWORD=null 23 | REDIS_PORT=6379 24 | 25 | MAIL_DRIVER=smtp 26 | MAIL_HOST=smtp.mailtrap.io 27 | MAIL_PORT=2525 28 | MAIL_USERNAME=null 29 | MAIL_PASSWORD=null 30 | MAIL_ENCRYPTION=null 31 | 32 | PUSHER_APP_ID= 33 | PUSHER_APP_KEY= 34 | PUSHER_APP_SECRET= 35 | 36 | LIMIT=5 -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /bootstrap/helpers.php: -------------------------------------------------------------------------------- 1 | page?:1; 6 | $limit=$request->limit?:config('config.limit'); 7 | $data=$model->skip($limit*($page-1))->take($limit)->get(); 8 | if($model->getTable()=='roles'){ 9 | $multiplied = $data->map(function ($item, $key) { 10 | $item->permission = $item->permissions()->pluck('name')->implode('|'); 11 | return $item; 12 | }); 13 | }else{ 14 | $multiplied = $data->map(function ($item, $key) { 15 | $item->roles = $item->roles()->pluck('name')->implode('|'); 16 | return $item; 17 | }); 18 | } 19 | return $multiplied; 20 | } -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /resources/assets/js/app.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * First we will load all of this project's JavaScript dependencies which 4 | * includes Vue and other libraries. It is a great starting point when 5 | * building robust, powerful web applications using Vue and Laravel. 6 | */ 7 | 8 | require('./bootstrap'); 9 | 10 | window.Vue = require('vue'); 11 | 12 | /** 13 | * Next, we will create a fresh Vue application instance and attach it to 14 | * the page. Then, you may begin adding components to this application 15 | * or customize the JavaScript scaffolding to fit your unique needs. 16 | */ 17 | 18 | Vue.component('example-component', require('./components/ExampleComponent.vue')); 19 | 20 | const app = new Vue({ 21 | el: '#app' 22 | }); 23 | -------------------------------------------------------------------------------- /resources/views/admin/permissions/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.layouts.app') 2 | @section('title','权限列表') 3 | 4 | @section('body') 5 |
6 | 权限列表 7 | 添加 8 |
9 |
10 | 13 | @endsection 14 | @section('scripts') 15 | 16 | @endsection 17 | 18 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Dashboard
9 | 10 |
11 | @if (session('status')) 12 |
13 | {{ session('status') }} 14 |
15 | @endif 16 | 17 | You are logged in! 18 |
19 |
20 |
21 |
22 |
23 | @endsection 24 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any events for your application. 23 | * 24 | * @return void 25 | */ 26 | public function boot() 27 | { 28 | parent::boot(); 29 | 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/views/admin/roles/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.layouts.app') 2 | @section('title','角色列表') 3 | 4 | @section('body') 5 |
6 | 角色列表 7 | 添加 8 |
9 |
10 | 14 | @endsection 15 | @section('scripts') 16 | 17 | @endsection 18 | 19 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | 'FORWARDED', 24 | Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', 25 | Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', 26 | Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', 27 | Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', 28 | ]; 29 | } 30 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | app = $app; 16 | } 17 | public function handle($request, Closure $next) 18 | { 19 | if ($this->app->isDownForMaintenance() && !strpos($request->getPathInfo(),'admin')) { 20 | $data = json_decode(file_get_contents($this->app->storagePath().'/framework/down'), true); 21 | 22 | throw new MaintenanceModeException($data['time'], $data['retry'], $data['message']); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ### Laravel admin 后台权限管理系统 2 | 3 | 基于 `Laravel 5.5` 的后端框架和 `layui 2.2.45` 的前端框架制作的一个后台管理系统,目前只做了权限管理和网站配置,可以在此基础上进行开发。 4 | 5 | 大楖上几张图吧 6 | 7 | ![laravel-admin](https://github.com/jourdon/laravel_admin_layui/blob/master/1.png) 8 | ![laravel-admin](https://github.com/jourdon/laravel_admin_layui/blob/master/2.png) 9 | ![laravel-admin](https://github.com/jourdon/laravel_admin_layui/blob/master/3.png) 10 | 11 | ### 安装方法 12 | 克隆github 13 | ``` 14 | git@github.com:jourdon/laravel_admin_layui.git 15 | ``` 16 | 生成配置文件 17 | ``` 18 | cp .env.example .env 19 | ``` 20 | 更新 `composer` 扩展包 21 | ``` 22 | composer update 23 | ``` 24 | 迁移数据库 25 | ``` 26 | php artisan migrate:refresh --seed 27 | ``` 28 | 默认会生成一些假数据,方便调试 29 | 首页使用 `Laravel` 的默认模板,登录后可通后 `admin` 目录登录后台 30 | 或者通后下图登录后台 31 | ![laravel-admin](https://github.com/jourdon/laravel_admin_layui/blob/master/4.png) 32 | 管理员邮箱:`admin@admin.com` 33 | 密码:`password` 34 | -------------------------------------------------------------------------------- /resources/views/admin/users/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.layouts.app') 2 | @section('title','用户列表') 3 | 4 | @section('body') 5 |
6 | 用户列表 7 | 添加 8 |
9 | 10 |
11 | 18 | @endsection 19 | @section('scripts') 20 | 21 | @endsection 22 | 23 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | attributes['password']=$value; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->string('password'); 21 | $table->rememberToken(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('users'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(App\Models\User::class, function (Faker $faker) { 17 | static $password; 18 | $date_time= $faker->dateTime; 19 | 20 | return [ 21 | 'name' => $faker->name, 22 | 'email' => $faker->unique()->safeEmail, 23 | 'password' => $password ?: $password = bcrypt('password'), 24 | 'remember_token' => str_random(10), 25 | 'created_at' => $date_time, 26 | 'updated_at' => $date_time, 27 | ]; 28 | }); 29 | -------------------------------------------------------------------------------- /public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 28 | // ->hourly(); 29 | } 30 | 31 | /** 32 | * Register the commands for the application. 33 | * 34 | * @return void 35 | */ 36 | protected function commands() 37 | { 38 | $this->load(__DIR__.'/Commands'); 39 | 40 | require base_path('routes/console.php'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /public/layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none} -------------------------------------------------------------------------------- /resources/assets/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | 2 | // Body 3 | $body-bg: #f5f8fa; 4 | 5 | // Borders 6 | $laravel-border-color: darken($body-bg, 10%); 7 | $list-group-border: $laravel-border-color; 8 | $navbar-default-border: $laravel-border-color; 9 | $panel-default-border: $laravel-border-color; 10 | $panel-inner-border: $laravel-border-color; 11 | 12 | // Brands 13 | $brand-primary: #3097D1; 14 | $brand-info: #8eb4cb; 15 | $brand-success: #2ab27b; 16 | $brand-warning: #cbb956; 17 | $brand-danger: #bf5329; 18 | 19 | // Typography 20 | $icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/"; 21 | $font-family-sans-serif: "Raleway", sans-serif; 22 | $font-size-base: 14px; 23 | $line-height-base: 1.6; 24 | $text-color: #636b6f; 25 | 26 | // Navbar 27 | $navbar-default-bg: #fff; 28 | 29 | // Buttons 30 | $btn-default-color: $text-color; 31 | 32 | // Inputs 33 | $input-border: lighten($text-color, 40%); 34 | $input-border-focus: lighten($brand-primary, 25%); 35 | $input-color-placeholder: lighten($text-color, 30%); 36 | 37 | // Panels 38 | $panel-default-heading-bg: #fff; 39 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'ses' => [ 23 | 'key' => env('SES_KEY'), 24 | 'secret' => env('SES_SECRET'), 25 | 'region' => 'us-east-1', 26 | ], 27 | 28 | 'sparkpost' => [ 29 | 'secret' => env('SPARKPOST_SECRET'), 30 | ], 31 | 32 | 'stripe' => [ 33 | 'model' => App\Models\User::class, 34 | 'key' => env('STRIPE_KEY'), 35 | 'secret' => env('STRIPE_SECRET'), 36 | ], 37 | 38 | ]; 39 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Feature 14 | 15 | 16 | 17 | ./tests/Unit 18 | 19 | 20 | 21 | 22 | ./app 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /public/layui/lay/modules/code.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('
  1. '+o.replace(/[\r\t\n]+/g,"
  2. ")+"
"),c.find(">.layui-code-h3")[0]||c.prepend('

'+(c.attr("lay-title")||e.title||"code")+(e.about?'layui.code':"")+"

");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss"); -------------------------------------------------------------------------------- /database/migrations/2017_12_16_143338_create_configs_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name')->default('J-Admin'); 19 | $table->string('keywords')->nullable(); 20 | $table->string('description')->nullable(); 21 | $table->string('url')->default('http://'); 22 | $table->string('email')->nullable(); 23 | $table->integer('status')->default(1); 24 | $table->text('statistics')->nullable(); 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('configs'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.17", 14 | "bootstrap-sass": "^3.3.7", 15 | "cross-env": "^5.1", 16 | "jquery": "^3.2", 17 | "laravel-mix": "^1.0", 18 | "lodash": "^4.17.4", 19 | "vue": "^2.5.7" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /resources/views/admin/layouts/_header.blade.php: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('home'); 21 | Route::group([ 22 | 'prefix'=>'admin', 23 | 'namespace'=>'Admin', 24 | 'middleware'=> 'auth', 25 | ], function(){ 26 | Route::get('/','IndexController@index')->name('admin'); 27 | 28 | Route::resource('config','ConfigController'); 29 | Route::get('down','ConfigController@down'); 30 | Route::get('up','ConfigController@up'); 31 | Route::resource('users','UsersController'); 32 | Route::get('api/users','UsersController@users'); 33 | Route::resource('roles','RolesController'); 34 | Route::get('api/roles','RolesController@roles'); 35 | Route::resource('permissions','PermissionController'); 36 | Route::get('api/permissions','PermissionController@permissions'); 37 | } 38 | ); -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | 2 | 系统管理 3 |
4 |
网站配置
5 | 6 |
7 | 8 |
  • 9 | 用户管理 10 |
    11 |
    用户列表
    12 |
    角色
    13 |
    权限
    14 |
    15 |
  • 16 |
  • 17 | 一级菜单 18 |
    19 |
    菜单项
    20 |
    菜单项
    21 |
    菜单项
    22 |
    23 |
  • 24 |
  • 25 | 一级菜单 26 |
    27 |
    菜单项
    28 |
    菜单项
    29 |
    菜单项
    30 |
    31 |
  • -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/ConfigController.php: -------------------------------------------------------------------------------- 1 | toArray(); 15 | return view('admin.config.index',compact('config')); 16 | } 17 | 18 | public function store(Request $request) 19 | { 20 | //try{ 21 | $config=Config::find(1); 22 | $this->validate($request,[ 23 | 'name'=>'required|max:10', 24 | 'email'=>'email', 25 | 'status'=>'required' 26 | ]); 27 | if($config->update($request->except('_token'))){ 28 | return ['code'=>1,'msg'=>'站点资料更新成功']; 29 | }else{ 30 | return ['code'=>0,'msg'=>'站点资料更新失败']; 31 | } 32 | //}catch (Exception $exception){ 33 | // return ['code'=>0,'msg'=>$exception->getMessage()]; 34 | //} 35 | } 36 | 37 | public function down(){ 38 | @touch(storage_path().'/framework/down'); 39 | Config::find(1)->update(['status'=>0]); 40 | return ['code'=>1,'msg'=>'网站处于维护模式']; 41 | } 42 | public function up() 43 | { 44 | unlink(storage_path().'/framework/down'); 45 | Config::find(1)->update(['status'=>1]); 46 | return ['code'=>1,'msg'=>'网站处于正常访问模式']; 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "type": "project", 7 | "require": { 8 | "php": ">=7.0.0", 9 | "fideloper/proxy": "~3.3", 10 | "laravel/framework": "5.5.*", 11 | "laravel/tinker": "~1.0", 12 | "overtrue/laravel-lang": "~3.0", 13 | "spatie/laravel-permission": "^2.7" 14 | }, 15 | "require-dev": { 16 | "filp/whoops": "~2.0", 17 | "fzaninotto/faker": "~1.4", 18 | "mockery/mockery": "~1.0", 19 | "phpunit/phpunit": "~6.0" 20 | }, 21 | "autoload": { 22 | "classmap": [ 23 | "database/seeds", 24 | "database/factories" 25 | ], 26 | "psr-4": { 27 | "App\\": "app/" 28 | } 29 | }, 30 | "autoload-dev": { 31 | "psr-4": { 32 | "Tests\\": "tests/" 33 | } 34 | }, 35 | "extra": { 36 | "laravel": { 37 | "dont-discover": [ 38 | ] 39 | } 40 | }, 41 | "scripts": { 42 | "post-root-package-install": [ 43 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 44 | ], 45 | "post-create-project-cmd": [ 46 | "@php artisan key:generate" 47 | ], 48 | "post-autoload-dump": [ 49 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 50 | "@php artisan package:discover" 51 | ] 52 | }, 53 | "config": { 54 | "preferred-install": "dist", 55 | "sort-packages": true, 56 | "optimize-autoloader": true 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | // 40 | ], 41 | ], 42 | 43 | 'redis' => [ 44 | 'driver' => 'redis', 45 | 'connection' => 'default', 46 | ], 47 | 48 | 'log' => [ 49 | 'driver' => 'log', 50 | ], 51 | 52 | 'null' => [ 53 | 'driver' => 'null', 54 | ], 55 | 56 | ], 57 | 58 | ]; 59 | -------------------------------------------------------------------------------- /public/layui/lay/modules/laytpl.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var r={open:"{{",close:"}}"},c={exp:function(e){return new RegExp(e,"g")},query:function(e,c,t){var o=["#([\\s\\S])+?","([^{#}])*?"][e||0];return n((c||"")+r.open+o+r.close+(t||""))},escape:function(e){return String(e||"").replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(//g,">").replace(/'/g,"'").replace(/"/g,""")},error:function(e,r){var c="Laytpl Error:";return"object"==typeof console&&console.error(c+e+"\n"+(r||"")),c+e}},n=c.exp,t=function(e){this.tpl=e};t.pt=t.prototype,window.errors=0,t.pt.parse=function(e,t){var o=this,p=e,a=n("^"+r.open+"#",""),l=n(r.close+"$","");e=e.replace(/\s+|\r|\t|\n/g," ").replace(n(r.open+"#"),r.open+"# ").replace(n(r.close+"}"),"} "+r.close).replace(/\\/g,"\\\\").replace(n(r.open+"!(.+?)!"+r.close),function(e){return e=e.replace(n("^"+r.open+"!"),"").replace(n("!"+r.close),"").replace(n(r.open+"|"+r.close),function(e){return e.replace(/(.)/g,"\\$1")})}).replace(/(?="|')/g,"\\").replace(c.query(),function(e){return e=e.replace(a,"").replace(l,""),'";'+e.replace(/\\/g,"")+';view+="'}).replace(c.query(1),function(e){var c='"+(';return e.replace(/\s/g,"")===r.open+r.close?"":(e=e.replace(n(r.open+"|"+r.close),""),/^=/.test(e)&&(e=e.replace(/^=/,""),c='"+_escape_('),c+e.replace(/\\/g,"")+')+"')}),e='"use strict";var view = "'+e+'";return view;';try{return o.cache=e=new Function("d, _escape_",e),e(t,c.escape)}catch(u){return delete o.cache,c.error(u,p)}},t.pt.render=function(e,r){var n,t=this;return e?(n=t.cache?t.cache(e,c.escape):t.parse(t.tpl,e),r?void r(n):n):c.error("no data")};var o=function(e){return"string"!=typeof e?c.error("Template not found"):new t(e)};o.config=function(e){e=e||{};for(var c in e)r[c]=e[c]},o.v="1.2.0",e("laytpl",o)}); -------------------------------------------------------------------------------- /resources/assets/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | 2 | window._ = require('lodash'); 3 | 4 | /** 5 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 6 | * for JavaScript based Bootstrap features such as modals and tabs. This 7 | * code may be modified to fit the specific needs of your application. 8 | */ 9 | 10 | try { 11 | window.$ = window.jQuery = require('jquery'); 12 | 13 | require('bootstrap-sass'); 14 | } catch (e) {} 15 | 16 | /** 17 | * We'll load the axios HTTP library which allows us to easily issue requests 18 | * to our Laravel back-end. This library automatically handles sending the 19 | * CSRF token as a header based on the value of the "XSRF" token cookie. 20 | */ 21 | 22 | window.axios = require('axios'); 23 | 24 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 25 | 26 | /** 27 | * Next we will register the CSRF Token as a common header with Axios so that 28 | * all outgoing HTTP requests automatically have it attached. This is just 29 | * a simple convenience so we don't have to attach every token manually. 30 | */ 31 | 32 | let token = document.head.querySelector('meta[name="csrf-token"]'); 33 | 34 | if (token) { 35 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; 36 | } else { 37 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 38 | } 39 | 40 | /** 41 | * Echo exposes an expressive API for subscribing to channels and listening 42 | * for events that are broadcast by Laravel. Echo and event broadcasting 43 | * allows your team to easily build robust real-time web applications. 44 | */ 45 | 46 | // import Echo from 'laravel-echo' 47 | 48 | // window.Pusher = require('pusher-js'); 49 | 50 | // window.Echo = new Echo({ 51 | // broadcaster: 'pusher', 52 | // key: 'your-pusher-key' 53 | // }); 54 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 39 | 40 | $this->mapWebRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::middleware('web') 55 | ->namespace($this->namespace) 56 | ->group(base_path('routes/web.php')); 57 | } 58 | 59 | /** 60 | * Define the "api" routes for the application. 61 | * 62 | * These routes are typically stateless. 63 | * 64 | * @return void 65 | */ 66 | protected function mapApiRoutes() 67 | { 68 | Route::prefix('api') 69 | ->middleware('api') 70 | ->namespace($this->namespace) 71 | ->group(base_path('routes/api.php')); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 32 | Illuminate\Contracts\Http\Kernel::class, 33 | App\Http\Kernel::class 34 | ); 35 | 36 | $app->singleton( 37 | Illuminate\Contracts\Console\Kernel::class, 38 | App\Console\Kernel::class 39 | ); 40 | 41 | $app->singleton( 42 | Illuminate\Contracts\Debug\ExceptionHandler::class, 43 | App\Exceptions\Handler::class 44 | ); 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Return The Application 49 | |-------------------------------------------------------------------------- 50 | | 51 | | This script returns the application instance. The instance is given to 52 | | the calling script so we can separate the building of the instances 53 | | from the actual running of the application and sending responses. 54 | | 55 | */ 56 | 57 | return $app; 58 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /public/layui/lay/modules/flow.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="加载更多",h=l('
    '+d+"
    ");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;su)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)}); -------------------------------------------------------------------------------- /database/migrations/2017_12_16_200551_seed_roles_and_permissions_data.php: -------------------------------------------------------------------------------- 1 | forget('spatie.permission.cache'); 22 | 23 | // 先创建权限 24 | Permission::create(['name' => 'manage_contents']); 25 | Permission::create(['name' => 'manage_users']); 26 | Permission::create(['name' => 'edit_settings']); 27 | 28 | // 创建站长角色,并赋予权限 29 | $founder = Role::create(['name' => 'Administrator']); 30 | $founder->givePermissionTo('manage_contents'); 31 | $founder->givePermissionTo('manage_users'); 32 | $founder->givePermissionTo('edit_settings'); 33 | 34 | // 创建管理员角色,并赋予权限 35 | $maintainer = Role::create(['name' => 'Manager']); 36 | $maintainer->givePermissionTo('manage_contents'); 37 | } 38 | 39 | /** 40 | * Reverse the migrations. 41 | * 42 | * @return void 43 | */ 44 | public function down() 45 | { 46 | // 清除缓存 47 | app()['cache']->forget('spatie.permission.cache'); 48 | 49 | // 清空所有数据表数据 50 | $tableNames = config('permission.table_names'); 51 | 52 | Model::unguard(); 53 | DB::table($tableNames['role_has_permissions'])->delete(); 54 | DB::table($tableNames['model_has_roles'])->delete(); 55 | DB::table($tableNames['model_has_permissions'])->delete(); 56 | DB::table($tableNames['roles'])->delete(); 57 | DB::table($tableNames['permissions'])->delete(); 58 | Model::reguard(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |
    Reset Password
    9 | 10 |
    11 | @if (session('status')) 12 |
    13 | {{ session('status') }} 14 |
    15 | @endif 16 | 17 |
    18 | {{ csrf_field() }} 19 | 20 |
    21 | 22 | 23 |
    24 | 25 | 26 | @if ($errors->has('email')) 27 | 28 | {{ $errors->first('email') }} 29 | 30 | @endif 31 |
    32 |
    33 | 34 |
    35 |
    36 | 39 |
    40 |
    41 |
    42 |
    43 |
    44 |
    45 |
    46 |
    47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/admin/roles/create_and_edit.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @extends('admin.layouts.app') 3 | @section('title',isset($roles->id)? '编辑角色':'添加角色') 4 | 5 | @section('body') 6 |
    7 | {{isset($roles->id)? '编辑角色':'添加角色'}} 8 | 返回列表 9 |
    10 | @if(isset($roles->id)) 11 |
    12 | 13 | @else 14 | 15 | @endif 16 | {{ csrf_field() }} 17 |
    18 | 19 |
    20 | 21 |
    22 |
    23 |
    24 | 25 |
    26 | @foreach($permissions as $permission) 27 | permission) && in_array($permission,$roles->permission))?'checked':'' }} lay-skin="primary"> 28 | @endforeach 29 |
    30 |
    31 |
    32 |
    33 | 34 | 35 |
    36 |
    37 |
    38 | 39 | @endsection 40 | 41 | @section('scripts') 42 | 43 | @endsection 44 | 45 | 46 | -------------------------------------------------------------------------------- /resources/views/admin/layouts/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('admin.layouts.app') 2 | @section('title','J-Admin') 3 | @section('styles') 4 | 9 | @endsection 10 | @section('body') 11 |
    12 | 13 | 14 | @include('admin.layouts._header') 15 |
    16 | 17 |
    18 |
    19 | 20 |
      21 | @include('admin.layouts._sidebar') 22 |
    23 |
    24 |
    25 | 26 |
    27 |
    28 |
      29 |
    • 后台首页
    • 30 |
    31 |
    32 |
    33 | 34 |
    35 | 服务器环境 36 |
    37 | 38 | @foreach($envs as $env) 39 |
    40 | 41 |
    42 | 43 |
    44 |
    45 | @endforeach 46 |
    47 |
    48 |
    49 |
    50 | 51 | 55 | @endsection 56 | 57 | @section('scripts') 58 | 59 | @endsection -------------------------------------------------------------------------------- /resources/views/admin/permissions/create_and_edit.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @extends('admin.layouts.app') 3 | @section('title',isset($permissions->id)? '编辑权限':'添加权限') 4 | 5 | @section('body') 6 |
    7 | {{isset($permissions->id)? '编辑权限':'添加权限'}} 8 | 返回列表 9 |
    10 | @if(isset($permissions->id)) 11 |
    12 | 13 | @else 14 | 15 | @endif 16 | {{ csrf_field() }} 17 |
    18 | 19 |
    20 | 21 |
    22 |
    23 |
    24 | 25 |
    26 | @foreach($roles as $role) 27 | role) && in_array($role,$permissions->role))?'checked':'' }} lay-skin="primary"> 28 | @endforeach 29 |
    30 |
    31 |
    32 |
    33 | 34 | 35 |
    36 |
    37 |
    38 | 39 | @endsection 40 | 41 | @section('scripts') 42 | 43 | @endsection 44 | 45 | 46 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 40 | } 41 | 42 | /** 43 | * Get a validator for an incoming registration request. 44 | * 45 | * @param array $data 46 | * @return \Illuminate\Contracts\Validation\Validator 47 | */ 48 | protected function validator(array $data) 49 | { 50 | return Validator::make($data, [ 51 | 'name' => 'required|string|max:255', 52 | 'email' => 'required|string|email|max:255|unique:users', 53 | 'password' => 'required|string|min:6|confirmed', 54 | ]); 55 | } 56 | 57 | /** 58 | * Create a new user instance after a valid registration. 59 | * 60 | * @param array $data 61 | * @return \App\Models\User 62 | */ 63 | protected function create(array $data) 64 | { 65 | return User::create([ 66 | 'name' => $data['name'], 67 | 'email' => $data['email'], 68 | 'password' => bcrypt($data['password']), 69 | ]); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /public/js/config.js: -------------------------------------------------------------------------------- 1 | var element; 2 | var $; 3 | layui.use(['element','jquery','form', 'layedit'],function(){ 4 | element = layui.element; 5 | $ = layui.jquery; 6 | var form = layui.form 7 | ,layer = layui.layer 8 | ,layedit = layui.layedit; 9 | 10 | 11 | //自定义验证规则 12 | form.verify({ 13 | title: function(value){ 14 | if(value.length < 5){ 15 | return '标题至少得5个字符啊'; 16 | } 17 | } 18 | ,pass: [/(.+){6,12}$/, '密码必须6到12位'] 19 | ,content: function(value){ 20 | layedit.sync(editIndex); 21 | } 22 | }); 23 | 24 | //监听指定开关 25 | form.on('switch(switchTest)', function(data){ 26 | if(this.checked){ 27 | url='/admin/up'; 28 | }else{ 29 | url='/admin/down'; 30 | } 31 | $.ajax({ 32 | type: 'get', 33 | dataType: 'json', 34 | url: url, 35 | success: function(data) { 36 | layer.alert(data.msg,{icon: 1}); 37 | }, 38 | error: function(data) { 39 | layer.msg('异常错误', {icon: 2}); 40 | } 41 | }); 42 | layer.tips('温馨提示:请注意开关状态代表网站前台的状态,后台不受影响', data.othis) 43 | }); 44 | 45 | //监听提交 46 | form.on('submit(config)', function(data){ 47 | data.field.status=data.field.status ? '1': '0';//开关是否开启,true或者false 48 | 49 | $.ajax({ 50 | type: 'post', 51 | dataType: 'json', 52 | url: data.form.action, 53 | data: data.field, 54 | success: function(data) { 55 | if(data.code==1){ 56 | layer.alert(data.msg,{icon: 1}); 57 | }else{ 58 | layer.alert(data.msg,{icon: 2}); 59 | } 60 | }, 61 | error : function (msg) { 62 | var json=JSON.parse(msg.responseText); 63 | $.each(json.errors,function(index,error){ 64 | $.each(error,function(key,value){ 65 | layer.alert(value,{icon: 2}); 66 | }); 67 | }); 68 | }, 69 | }); 70 | return false; 71 | }); 72 | 73 | }); -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "s3", "rackspace" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | ], 65 | 66 | ], 67 | 68 | ]; 69 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 38 | \App\Http\Middleware\VerifyCsrfToken::class, 39 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 40 | ], 41 | 42 | 'api' => [ 43 | 'throttle:60,1', 44 | 'bindings', 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's route middleware. 50 | * 51 | * These middleware may be assigned to groups or used individually. 52 | * 53 | * @var array 54 | */ 55 | protected $routeMiddleware = [ 56 | 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 59 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 60 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 62 | ]; 63 | } 64 | -------------------------------------------------------------------------------- /public/layui/lay/modules/util.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var t=layui.$,i={fixbar:function(e){var i,o,a="layui-fixbar",r="layui-fixbar-top",n=t(document),l=t("body");e=t.extend({showHeight:200},e),e.bar1=e.bar1===!0?"":e.bar1,e.bar2=e.bar2===!0?"":e.bar2,e.bgcolor=e.bgcolor?"background-color:"+e.bgcolor:"";var c=[e.bar1,e.bar2,""],g=t(['"].join("")),s=g.find("."+r),u=function(){var t=n.scrollTop();t>=e.showHeight?i||(s.show(),i=1):i&&(s.hide(),i=0)};t("."+a)[0]||("object"==typeof e.css&&g.css(e.css),l.append(g),u(),g.find("li").on("click",function(){var i=t(this),o=i.attr("lay-type");"top"===o&&t("html,body").animate({scrollTop:0},200),e.click&&e.click.call(this,o)}),n.on("scroll",function(){clearTimeout(o),o=setTimeout(function(){u()},100)}))},countdown:function(e,t,i){var o=this,a="function"==typeof t,r=new Date(e).getTime(),n=new Date(!t||a?(new Date).getTime():t).getTime(),l=r-n,c=[Math.floor(l/864e5),Math.floor(l/36e5)%24,Math.floor(l/6e4)%60,Math.floor(l/1e3)%60];a&&(i=t);var g=setTimeout(function(){o.countdown(e,n+1e3,i)},1e3);return i&&i(l>0?c:[0,0,0,0],t,g),l<=0&&clearTimeout(g),g},timeAgo:function(e,t){var i=this,o=[[],[]],a=(new Date).getTime()-new Date(e).getTime();return a>6912e5?(a=new Date(e),o[0][0]=i.digit(a.getFullYear(),4),o[0][1]=i.digit(a.getMonth()+1),o[0][2]=i.digit(a.getDate()),t||(o[1][0]=i.digit(a.getHours()),o[1][1]=i.digit(a.getMinutes()),o[1][2]=i.digit(a.getSeconds())),o[0].join("-")+" "+o[1].join(":")):a>=864e5?(a/1e3/60/60/24|0)+"天前":a>=36e5?(a/1e3/60/60|0)+"小时前":a>=12e4?(a/1e3/60|0)+"分钟前":a<0?"未来":"刚刚"},digit:function(e,t){var i="";e=String(e),t=t||2;for(var o=e.length;ocount(); 21 | $data=getRoleOrPermissionApi($request,$permissions); 22 | 23 | return [ 24 | 'code' => 0, 25 | 'msg' => '', 26 | 'count' => $count, 27 | 'data' =>$data, 28 | ]; 29 | } 30 | 31 | public function create(Permission $permissions) 32 | { 33 | $roles=Role::all()->pluck('name')->toArray(); 34 | return view('admin.permissions.create_and_edit',compact('roles','permissions')); 35 | } 36 | 37 | public function store(Request $request) 38 | { 39 | $this->validate($request,[ 40 | 'name' => 'required|unique:permissions,name', 41 | ]); 42 | $permission = Permission::create(['name' => $request->name]); 43 | 44 | if($request->roles){ 45 | foreach($request->roles as $role){ 46 | $role->givePermissionTo($permission); 47 | } 48 | } 49 | return ['code'=>1,'msg'=>'添加成功']; 50 | } 51 | 52 | public function edit($id) 53 | { 54 | $permissions=Permission::find($id); 55 | $permissions->role=$permissions->roles()->pluck('name')->toArray(); 56 | $roles=Role::all()->pluck('name')->toArray(); 57 | 58 | return view('admin.permissions.create_and_edit',compact('roles','permissions')); 59 | } 60 | 61 | public function update(Request $request,$id) 62 | { 63 | $data=array_filter($request->all()); 64 | $this->validate($request,[ 65 | 'name' => 'required|min:3|max:15', 66 | ]); 67 | $model=Permission::find($id); 68 | $permission=$model->name; 69 | $model->update(['name'=>$data['name']]); 70 | $roles=$model->roles()->get(); 71 | if($roles){ 72 | foreach($roles as $item){ 73 | $item->revokePermissionTo($permission); 74 | } 75 | } 76 | if(isset($data['roles'])){ 77 | foreach($data['roles'] as $item){ 78 | $role=Role::findByName($item); 79 | //dd($data,$role); 80 | $role->givePermissionTo($permission); 81 | } 82 | } 83 | return ['code'=>1,'msg'=>'修改成功']; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /public/js/permissions.js: -------------------------------------------------------------------------------- 1 | layui.use(['table','element','form','jquery'], function(){ 2 | var table = layui.table 3 | ,form = layui.form 4 | ,$ = layui.jquery; 5 | //第一个实例 6 | table.render({ 7 | elem: '#permissions_table' 8 | ,url: '/admin/api/permissions' //数据接口 9 | ,limit: 5 10 | ,page: true //开启分页 11 | ,cols: [[ //表头 12 | {fixed: 'left',checkbox : true} 13 | ,{field: 'id', title: 'ID', width:50, align:'center',sort: true} 14 | ,{field: 'name', title: '权限名称', align:'center',width:150} 15 | ,{field: 'roles', title: '角色名称', align:'center'} 16 | ,{title: '操作', width:150, align:'center', toolbar: '#permissions_tools'} //这里的toolbar值是模板元素的选择器 17 | ]] 18 | }); 19 | //监听工具条 20 | table.on('tool(permissions_table)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值" 21 | var data = obj.data; //获得当前行数据 22 | var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) 23 | var tr = obj.tr; //获得当前行 tr 的DOM对象 24 | 25 | if (layEvent === 'edit') { //编辑 26 | //do something 27 | console.log(obj); 28 | location.href= '/admin/permissions/'+obj.data.id+'/edit'; 29 | } 30 | }); 31 | 32 | //自定义验证规则 33 | form.verify({ 34 | name: function(value, item){ //value:表单的值、item:表单的DOM对象 35 | if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){ 36 | return '用户名不能有特殊字符'; 37 | } 38 | if(/(^\_)|(\__)|(\_+$)/.test(value)){ 39 | return '用户名首尾不能出现下划线\'_\''; 40 | } 41 | if(/^\d+\d+\d$/.test(value)){ 42 | return '用户名不能全为数字'; 43 | } 44 | }, 45 | }); 46 | //监听提交 47 | form.on('submit(permission)', function(data) { 48 | $.ajax({ 49 | type: 'post', 50 | dataType: 'json', 51 | url: data.form.action, 52 | data: data.field, 53 | success: function(data) { 54 | if(data.code==1){ 55 | layer.alert(data.msg,{icon: 1}); 56 | location.href = '/admin/permissions'; 57 | }else{ 58 | layer.alert(data.msg,{icon: 2}); 59 | } 60 | }, 61 | error : function (msg) { 62 | console.log('error'); 63 | var json=JSON.parse(msg.responseText); 64 | $.each(json.errors,function(index,error){ 65 | $.each(error,function(key,value){ 66 | layer.alert(value,{icon: 2}); 67 | }); 68 | }); 69 | } 70 | }); 71 | return false; 72 | }); 73 | }); -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/UsersController.php: -------------------------------------------------------------------------------- 1 | count(); 21 | $data=getRoleOrPermissionApi($request,$users); 22 | 23 | //$data=$user->skip($limit*($page-1))->take($limit)->get()->toArray(); 24 | 25 | return [ 26 | 'code' => 0, 27 | 'msg' => '', 28 | 'count' => $count, 29 | 'data' =>$data, 30 | ]; 31 | } 32 | 33 | public function create(User $user) 34 | { 35 | $roles=Role::all()->pluck('name')->toArray(); 36 | return view('admin.users.create_and_edit',compact('user','roles')); 37 | } 38 | 39 | 40 | public function store(Request $request) 41 | { 42 | $this->validate($request,[ 43 | 'name' => 'required|min:3|max:15', 44 | 'email' => 'required|email|unique:users,email', 45 | 'password' => 'required|min:6|max:20|confirmed' 46 | ]); 47 | $user=User::create([ 48 | 'name' => $request->name, 49 | 'email' => $request->email, 50 | 'password' => bcrypt($request->password), 51 | ]); 52 | if($request->role){ 53 | $user->assignRole($request->role); 54 | } 55 | return ['code'=>1,'msg'=>'添加成功']; 56 | } 57 | 58 | public function edit(User $user) 59 | { 60 | $roles=Role::all()->pluck('name')->toArray(); 61 | $role=$user->roles()->pluck('name')->first(); 62 | return view('admin.users.create_and_edit',compact('user','roles','role')); 63 | } 64 | 65 | public function update(Request $request, User $user) 66 | { 67 | $data=array_filter($request->all()); 68 | $this->validate($request,[ 69 | 'name' => 'required|min:3|max:15', 70 | 'email' => 'required|email|unique:users,email,'.$user->id, 71 | 'password' => 'required|min:6|confirmed' 72 | ]); 73 | $user->update($data); 74 | 75 | $role=$user->roles()->pluck('name')->first(); 76 | if($role){ 77 | $user->removeRole($role); 78 | } 79 | if($request->role){ 80 | $user->assignRole($request->role); 81 | } 82 | return ['code'=>1,'msg'=>'修改成功']; 83 | } 84 | 85 | public function destroy($id) 86 | { 87 | User::find($id)->delete(); 88 | return ['code'=>1,'msg'=>'删除成功']; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => 'your-public-key', 54 | 'secret' => 'your-secret-key', 55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', 56 | 'queue' => 'your-queue-name', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'retry_after' => 90, 65 | ], 66 | 67 | ], 68 | 69 | /* 70 | |-------------------------------------------------------------------------- 71 | | Failed Queue Jobs 72 | |-------------------------------------------------------------------------- 73 | | 74 | | These options configure the behavior of failed queue job logging so you 75 | | can control which database and table are used to store the jobs that 76 | | have failed. You may change them to any database / table you wish. 77 | | 78 | */ 79 | 80 | 'failed' => [ 81 | 'database' => env('DB_CONNECTION', 'mysql'), 82 | 'table' => 'failed_jobs', 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/RolesController.php: -------------------------------------------------------------------------------- 1 | count(); 20 | $data=getRoleOrPermissionApi($request,$roles); 21 | 22 | return [ 23 | 'code' => 0, 24 | 'msg' => '', 25 | 'count' => $count, 26 | 'data' =>$data, 27 | ]; 28 | } 29 | 30 | public function create(Role $roles) 31 | { 32 | $permissions=Permission::all()->pluck('name')->toArray(); 33 | return view('admin.roles.create_and_edit',compact('roles','permissions')); 34 | } 35 | 36 | public function store(Request $request) 37 | { 38 | $this->validate($request,[ 39 | 'name' => 'required|unique:roles,name', 40 | ]); 41 | $role = Role::create(['name' => $request->name]); 42 | if($request->permission){ 43 | $role->givePermissionTo($request->permission); 44 | } 45 | return ['code'=>1,'msg'=>'修改成功']; 46 | } 47 | 48 | public function edit($id) 49 | { 50 | $roles=Role::find($id); 51 | $roles->permission=$roles->permissions()->pluck('name')->toArray(); 52 | $permissions=Permission::all()->pluck('name')->toArray(); 53 | return view('admin.roles.create_and_edit',compact('roles','permissions')); 54 | } 55 | 56 | public function update(Request $request,$id) 57 | { 58 | $data=array_filter($request->all()); 59 | $this->validate($request,[ 60 | 'name' => 'required|min:3|max:15', 61 | ]); 62 | $role=Role::find($id); 63 | $role->update(['name'=>$data['name']]); 64 | 65 | 66 | $permissions=$role->permissions()->pluck('name')->toArray(); 67 | 68 | if($permissions){ 69 | foreach($permissions as $item){ 70 | $role->revokePermissionTo($item); 71 | } 72 | } 73 | if(isset($data['permission'])){ 74 | $role->givePermissionTo($data['permission']); 75 | } 76 | return ['code'=>1,'msg'=>'修改成功']; 77 | } 78 | public function destroy($id) 79 | { 80 | $roles=Role::find($id); 81 | $permissions=$roles->permissions()->pluck('name')->toArray(); 82 | foreach($permissions as $item){ 83 | $roles->revokePermissionTo($item); 84 | } 85 | $roles->delete(); 86 | return ['code'=>1,'msg'=>'删除成功']; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /public/layui/lay/modules/tree.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var o=layui.$,a=layui.hint(),i="layui-tree-enter",r=function(e){this.options=e},t={arrow:["",""],checkbox:["",""],radio:["",""],branch:["",""],leaf:""};r.prototype.init=function(e){var o=this;e.addClass("layui-box layui-tree"),o.options.skin&&e.addClass("layui-tree-skin-"+o.options.skin),o.tree(e),o.on(e)},r.prototype.tree=function(e,a){var i=this,r=i.options,n=a||r.nodes;layui.each(n,function(a,n){var l=n.children&&n.children.length>0,c=o(''),s=o(["
  • ",function(){return l?''+(n.spread?t.arrow[1]:t.arrow[0])+"":""}(),function(){return r.check?''+("checkbox"===r.check?t.checkbox[0]:"radio"===r.check?t.radio[0]:"")+"":""}(),function(){return'"+(''+(l?n.spread?t.branch[1]:t.branch[0]:t.leaf)+"")+(""+(n.name||"未命名")+"")}(),"
  • "].join(""));l&&(s.append(c),i.tree(c,n.children)),e.append(s),"function"==typeof r.click&&i.click(s,n),i.spread(s,n),r.drag&&i.drag(s,n)})},r.prototype.click=function(e,o){var a=this,i=a.options;e.children("a").on("click",function(e){layui.stope(e),i.click(o)})},r.prototype.spread=function(e,o){var a=this,i=(a.options,e.children(".layui-tree-spread")),r=e.children("ul"),n=e.children("a"),l=function(){e.data("spread")?(e.data("spread",null),r.removeClass("layui-show"),i.html(t.arrow[0]),n.find(".layui-icon").html(t.branch[0])):(e.data("spread",!0),r.addClass("layui-show"),i.html(t.arrow[1]),n.find(".layui-icon").html(t.branch[1]))};r[0]&&(i.on("click",l),n.on("dblclick",l))},r.prototype.on=function(e){var a=this,r=a.options,t="layui-tree-drag";e.find("i").on("selectstart",function(e){return!1}),r.drag&&o(document).on("mousemove",function(e){var i=a.move;if(i.from){var r=(i.to,o('
    '));e.preventDefault(),o("."+t)[0]||o("body").append(r);var n=o("."+t)[0]?o("."+t):r;n.addClass("layui-show").html(i.from.elem.children("a").html()),n.css({left:e.pageX+10,top:e.pageY+10})}}).on("mouseup",function(){var e=a.move;e.from&&(e.from.elem.children("a").removeClass(i),e.to&&e.to.elem.children("a").removeClass(i),a.move={},o("."+t).remove())})},r.prototype.move={},r.prototype.drag=function(e,a){var r=this,t=(r.options,e.children("a")),n=function(){var t=o(this),n=r.move;n.from&&(n.to={item:a,elem:e},t.addClass(i))};t.on("mousedown",function(){var o=r.move;o.from={item:a,elem:e}}),t.on("mouseenter",n).on("mousemove",n).on("mouseleave",function(){var e=o(this),a=r.move;a.from&&(delete a.to,e.removeClass(i))})},e("tree",function(e){var i=new r(e=e||{}),t=o(e.elem);return t[0]?void i.init(t):a.error("layui.tree 没有找到"+e.elem+"元素")})}); -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache/data'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 55 | 'sasl' => [ 56 | env('MEMCACHED_USERNAME'), 57 | env('MEMCACHED_PASSWORD'), 58 | ], 59 | 'options' => [ 60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 61 | ], 62 | 'servers' => [ 63 | [ 64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 65 | 'port' => env('MEMCACHED_PORT', 11211), 66 | 'weight' => 100, 67 | ], 68 | ], 69 | ], 70 | 71 | 'redis' => [ 72 | 'driver' => 'redis', 73 | 'connection' => 'default', 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Cache Key Prefix 81 | |-------------------------------------------------------------------------- 82 | | 83 | | When utilizing a RAM based store such as APC or Memcached, there might 84 | | be other applications utilizing the same cache. So, we'll specify a 85 | | value to get prefixed to all our keys so we can avoid collisions. 86 | | 87 | */ 88 | 89 | 'prefix' => env( 90 | 'CACHE_PREFIX', 91 | str_slug(env('APP_NAME', 'laravel'), '_').'_cache' 92 | ), 93 | 94 | ]; 95 | -------------------------------------------------------------------------------- /app/Http/Controllers/Admin/IndexController.php: -------------------------------------------------------------------------------- 1 | pluck('name')->first(); 15 | $envs = [ 16 | ['name' => 'PHP version', 'value' => 'PHP/'.PHP_VERSION], 17 | ['name' => 'Laravel version', 'value' => app()->version()], 18 | ['name' => 'CGI', 'value' => php_sapi_name()], 19 | ['name' => 'Uname', 'value' => php_uname()], 20 | ['name' => 'Server', 'value' => array_get($_SERVER, 'SERVER_SOFTWARE')], 21 | 22 | ['name' => 'Cache driver', 'value' => config('cache.default')], 23 | ['name' => 'Session driver', 'value' => config('session.driver')], 24 | ['name' => 'Queue driver', 'value' => config('queue.default')], 25 | 26 | ['name' => 'Timezone', 'value' => config('app.timezone')], 27 | ['name' => 'Locale', 'value' => config('app.locale')], 28 | ['name' => 'Env', 'value' => config('app.env')], 29 | ['name' => 'URL', 'value' => config('app.url')], 30 | ]; 31 | return view('admin.layouts.index',compact('envs','site_name')); 32 | } 33 | 34 | /** 35 | * Show the form for creating a new resource. 36 | * 37 | * @return \Illuminate\Http\Response 38 | */ 39 | public function create() 40 | { 41 | // 42 | } 43 | 44 | /** 45 | * Store a newly created resource in storage. 46 | * 47 | * @param \Illuminate\Http\Request $request 48 | * @return \Illuminate\Http\Response 49 | */ 50 | public function store(Request $request) 51 | { 52 | // 53 | } 54 | 55 | /** 56 | * Display the specified resource. 57 | * 58 | * @param int $id 59 | * @return \Illuminate\Http\Response 60 | */ 61 | public function show($id) 62 | { 63 | // 64 | } 65 | 66 | /** 67 | * Show the form for editing the specified resource. 68 | * 69 | * @param int $id 70 | * @return \Illuminate\Http\Response 71 | */ 72 | public function edit($id) 73 | { 74 | // 75 | } 76 | 77 | /** 78 | * Update the specified resource in storage. 79 | * 80 | * @param \Illuminate\Http\Request $request 81 | * @param int $id 82 | * @return \Illuminate\Http\Response 83 | */ 84 | public function update(Request $request, $id) 85 | { 86 | // 87 | } 88 | 89 | /** 90 | * Remove the specified resource from storage. 91 | * 92 | * @param int $id 93 | * @return \Illuminate\Http\Response 94 | */ 95 | public function destroy($id) 96 | { 97 | // 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Laravel 9 | 10 | 11 | 12 | 13 | 14 | 66 | 67 | 68 |
    69 | @if (Route::has('login')) 70 | 78 | @endif 79 | 80 |
    81 |
    82 | Laravel 83 |
    84 | 85 | 92 |
    93 |
    94 | 95 | 96 | -------------------------------------------------------------------------------- /config/permission.php: -------------------------------------------------------------------------------- 1 | [ 6 | 7 | /* 8 | * When using the "HasRoles" trait from this package, we need to know which 9 | * Eloquent model should be used to retrieve your permissions. Of course, it 10 | * is often just the "Permission" model but you may use whatever you like. 11 | * 12 | * The model you want to use as a Permission model needs to implement the 13 | * `Spatie\Permission\Contracts\Permission` contract. 14 | */ 15 | 16 | 'permission' => Spatie\Permission\Models\Permission::class, 17 | 18 | /* 19 | * When using the "HasRoles" trait from this package, we need to know which 20 | * Eloquent model should be used to retrieve your roles. Of course, it 21 | * is often just the "Role" model but you may use whatever you like. 22 | * 23 | * The model you want to use as a Role model needs to implement the 24 | * `Spatie\Permission\Contracts\Role` contract. 25 | */ 26 | 27 | 'role' => Spatie\Permission\Models\Role::class, 28 | 29 | ], 30 | 31 | 'table_names' => [ 32 | 33 | /* 34 | * When using the "HasRoles" trait from this package, we need to know which 35 | * table should be used to retrieve your roles. We have chosen a basic 36 | * default value but you may easily change it to any table you like. 37 | */ 38 | 39 | 'roles' => 'roles', 40 | 41 | /* 42 | * When using the "HasRoles" trait from this package, we need to know which 43 | * table should be used to retrieve your permissions. We have chosen a basic 44 | * default value but you may easily change it to any table you like. 45 | */ 46 | 47 | 'permissions' => 'permissions', 48 | 49 | /* 50 | * When using the "HasRoles" trait from this package, we need to know which 51 | * table should be used to retrieve your models permissions. We have chosen a 52 | * basic default value but you may easily change it to any table you like. 53 | */ 54 | 55 | 'model_has_permissions' => 'model_has_permissions', 56 | 57 | /* 58 | * When using the "HasRoles" trait from this package, we need to know which 59 | * table should be used to retrieve your models roles. We have chosen a 60 | * basic default value but you may easily change it to any table you like. 61 | */ 62 | 63 | 'model_has_roles' => 'model_has_roles', 64 | 65 | /* 66 | * When using the "HasRoles" trait from this package, we need to know which 67 | * table should be used to retrieve your roles permissions. We have chosen a 68 | * basic default value but you may easily change it to any table you like. 69 | */ 70 | 71 | 'role_has_permissions' => 'role_has_permissions', 72 | ], 73 | 74 | /* 75 | * By default all permissions will be cached for 24 hours unless a permission or 76 | * role is updated. Then the cache will be flushed immediately. 77 | */ 78 | 79 | 'cache_expiration_time' => 60 * 24, 80 | ]; 81 | -------------------------------------------------------------------------------- /database/migrations/2017_12_16_195058_create_permission_tables.php: -------------------------------------------------------------------------------- 1 | increments('id'); 19 | $table->string('name'); 20 | $table->string('guard_name'); 21 | $table->timestamps(); 22 | }); 23 | 24 | Schema::create($tableNames['roles'], function (Blueprint $table) { 25 | $table->increments('id'); 26 | $table->string('name'); 27 | $table->string('guard_name'); 28 | $table->timestamps(); 29 | }); 30 | 31 | Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames) { 32 | $table->integer('permission_id')->unsigned(); 33 | $table->morphs('model'); 34 | 35 | $table->foreign('permission_id') 36 | ->references('id') 37 | ->on($tableNames['permissions']) 38 | ->onDelete('cascade'); 39 | 40 | $table->primary(['permission_id', 'model_id', 'model_type']); 41 | }); 42 | 43 | Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames) { 44 | $table->integer('role_id')->unsigned(); 45 | $table->morphs('model'); 46 | 47 | $table->foreign('role_id') 48 | ->references('id') 49 | ->on($tableNames['roles']) 50 | ->onDelete('cascade'); 51 | 52 | $table->primary(['role_id', 'model_id', 'model_type']); 53 | }); 54 | 55 | Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { 56 | $table->integer('permission_id')->unsigned(); 57 | $table->integer('role_id')->unsigned(); 58 | 59 | $table->foreign('permission_id') 60 | ->references('id') 61 | ->on($tableNames['permissions']) 62 | ->onDelete('cascade'); 63 | 64 | $table->foreign('role_id') 65 | ->references('id') 66 | ->on($tableNames['roles']) 67 | ->onDelete('cascade'); 68 | 69 | $table->primary(['permission_id', 'role_id']); 70 | 71 | Cache::forget('spatie.permission.cache'); 72 | }); 73 | } 74 | 75 | /** 76 | * Reverse the migrations. 77 | * 78 | * @return void 79 | */ 80 | public function down() 81 | { 82 | $tableNames = config('permission.table_names'); 83 | 84 | Schema::drop($tableNames['role_has_permissions']); 85 | Schema::drop($tableNames['model_has_roles']); 86 | Schema::drop($tableNames['model_has_permissions']); 87 | Schema::drop($tableNames['roles']); 88 | Schema::drop($tableNames['permissions']); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /resources/views/admin/config/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @extends('admin.layouts.app') 3 | @section('title','网站配置') 4 | 5 | @section('body') 6 |
    7 | 网站配置 8 |
    9 | 10 |
    11 | {{ csrf_field() }} 12 |
    13 | 14 |
    15 | 16 |
    17 |
    18 |
    19 | 20 |
    21 | 22 |
    23 |
    24 |
    25 | 26 |
    27 | 28 |
    29 |
    30 |
    31 | 32 |
    33 | 34 |
    35 |
    36 |
    37 | 38 |
    39 | 40 |
    41 |
    42 |
    43 | 44 |
    45 | 46 |
    47 |
    默认为开启
    48 |
    49 |
    50 | 51 |
    52 | 53 |
    54 |
    55 |
    56 |
    57 | 58 | 59 |
    60 |
    61 |
    62 | 63 | @endsection 64 | 65 | @section('scripts') 66 | 67 | @endsection 68 | 69 | 70 | -------------------------------------------------------------------------------- /resources/views/admin/users/create_and_edit.blade.php: -------------------------------------------------------------------------------- 1 | 2 | @extends('admin.layouts.app') 3 | @section('title',$user->id? '编辑用户':'添加用户') 4 | 5 | @section('body') 6 |
    7 | {{$user->id? '编辑用户':'添加用户'}} 8 | 返回列表 9 |
    10 | @if($user->id) 11 |
    12 | 13 | @else 14 | 15 | @endif 16 | {{ csrf_field() }} 17 |
    18 | 19 |
    20 | 21 |
    22 |
    23 |
    24 | 25 |
    26 | 27 |
    28 |
    29 |
    30 | 31 |
    32 | 33 |
    34 |
    35 |
    36 | 37 |
    38 | 39 |
    40 |
    41 | 42 |
    43 | 44 |
    45 | 51 |
    52 |
    53 | 54 |
    55 |
    56 | 57 | 58 |
    59 |
    60 |
    61 | 62 | @endsection 63 | 64 | @section('scripts') 65 | 66 | @endsection 67 | 68 | 69 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |
    Login
    9 | 10 |
    11 |
    12 | {{ csrf_field() }} 13 | 14 |
    15 | 16 | 17 |
    18 | 19 | 20 | @if ($errors->has('email')) 21 | 22 | {{ $errors->first('email') }} 23 | 24 | @endif 25 |
    26 |
    27 | 28 |
    29 | 30 | 31 |
    32 | 33 | 34 | @if ($errors->has('password')) 35 | 36 | {{ $errors->first('password') }} 37 | 38 | @endif 39 |
    40 |
    41 | 42 |
    43 |
    44 |
    45 | 48 |
    49 |
    50 |
    51 | 52 |
    53 |
    54 | 57 | 58 | 59 | Forgot Your Password? 60 | 61 |
    62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |
    69 | @endsection 70 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |
    Reset Password
    9 | 10 |
    11 |
    12 | {{ csrf_field() }} 13 | 14 | 15 | 16 |
    17 | 18 | 19 |
    20 | 21 | 22 | @if ($errors->has('email')) 23 | 24 | {{ $errors->first('email') }} 25 | 26 | @endif 27 |
    28 |
    29 | 30 |
    31 | 32 | 33 |
    34 | 35 | 36 | @if ($errors->has('password')) 37 | 38 | {{ $errors->first('password') }} 39 | 40 | @endif 41 |
    42 |
    43 | 44 |
    45 | 46 |
    47 | 48 | 49 | @if ($errors->has('password_confirmation')) 50 | 51 | {{ $errors->first('password_confirmation') }} 52 | 53 | @endif 54 |
    55 |
    56 | 57 |
    58 |
    59 | 62 |
    63 |
    64 |
    65 |
    66 |
    67 |
    68 |
    69 |
    70 | @endsection 71 | -------------------------------------------------------------------------------- /public/layui/lay/modules/carousel.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.elemItem.length<=1||(e.indicator(),e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['",'"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['
      ',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("")}),i.join("")}(),"
    "].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'token', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\Models\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | You may specify multiple password reset configurations if you have more 85 | | than one user table or model in the application and you want to have 86 | | separate password reset settings based on the specific user types. 87 | | 88 | | The expire time is the number of minutes that the reset token should be 89 | | considered valid. This security feature keeps tokens short-lived so 90 | | they have less time to be guessed. You may change this as needed. 91 | | 92 | */ 93 | 94 | 'passwords' => [ 95 | 'users' => [ 96 | 'provider' => 'users', 97 | 'table' => 'password_resets', 98 | 'expire' => 60, 99 | ], 100 | ], 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |
    Register
    9 | 10 |
    11 |
    12 | {{ csrf_field() }} 13 | 14 |
    15 | 16 | 17 |
    18 | 19 | 20 | @if ($errors->has('name')) 21 | 22 | {{ $errors->first('name') }} 23 | 24 | @endif 25 |
    26 |
    27 | 28 |
    29 | 30 | 31 |
    32 | 33 | 34 | @if ($errors->has('email')) 35 | 36 | {{ $errors->first('email') }} 37 | 38 | @endif 39 |
    40 |
    41 | 42 |
    43 | 44 | 45 |
    46 | 47 | 48 | @if ($errors->has('password')) 49 | 50 | {{ $errors->first('password') }} 51 | 52 | @endif 53 |
    54 |
    55 | 56 |
    57 | 58 | 59 |
    60 | 61 |
    62 |
    63 | 64 |
    65 |
    66 | 69 |
    70 |
    71 |
    72 |
    73 |
    74 |
    75 |
    76 |
    77 | @endsection 78 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | {{ config('app.name', 'Laravel') }} 12 | 13 | 14 | 15 | 16 | 17 |
    18 | 79 | 80 | @yield('content') 81 |
    82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /public/layui/lay/modules/laypage.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;layui.define(function(e){"use strict";var a=document,t="getElementById",n="getElementsByTagName",i="laypage",r="layui-disabled",u=function(e){var a=this;a.config=e||{},a.config.index=++s.index,a.render(!0)};u.prototype.type=function(){var e=this.config;if("object"==typeof e.elem)return void 0===e.elem.length?2:3},u.prototype.view=function(){var e=this,a=e.config,t=a.groups="groups"in a?0|a.groups:5;a.layout="object"==typeof a.layout?a.layout:["prev","page","next"],a.count=0|a.count,a.curr=0|a.curr||1,a.limits="object"==typeof a.limits?a.limits:[10,20,30,40,50],a.limit=0|a.limit||10,a.pages=Math.ceil(a.count/a.limit)||1,a.curr>a.pages&&(a.curr=a.pages),t<0?t=1:t>a.pages&&(t=a.pages),a.prev="prev"in a?a.prev:"上一页",a.next="next"in a?a.next:"下一页";var n=a.pages>t?Math.ceil((a.curr+(t>1?1:0))/(t>0?t:1)):1,i={prev:function(){return a.prev?''+a.prev+"":""}(),page:function(){var e=[];if(a.count<1)return"";n>1&&a.first!==!1&&0!==t&&e.push(''+(a.first||1)+"");var i=Math.floor((t-1)/2),r=n>1?a.curr-i:1,u=n>1?function(){var e=a.curr+(t-i-1);return e>a.pages?a.pages:e}():t;for(u-r2&&e.push('');r<=u;r++)r===a.curr?e.push('"+r+""):e.push(''+r+"");return a.pages>t&&a.pages>u&&a.last!==!1&&(u+1…'),0!==t&&e.push(''+(a.last||a.pages)+"")),e.join("")}(),next:function(){return a.next?''+a.next+"":""}(),count:'共 '+a.count+" 条",limit:function(){var e=['"}(),skip:function(){return['到第','','页',""].join("")}()};return['
    ',function(){var e=[];return layui.each(a.layout,function(a,t){i[t]&&e.push(i[t])}),e.join("")}(),"
    "].join("")},u.prototype.jump=function(e,a){if(e){var t=this,i=t.config,r=e.children,u=e[n]("button")[0],l=e[n]("input")[0],p=e[n]("select")[0],c=function(){var e=0|l.value.replace(/\s|\D/g,"");e&&(i.curr=e,t.render())};if(a)return c();for(var o=0,y=r.length;oi.pages||(i.curr=e,t.render())});p&&s.on(p,"change",function(){var e=this.value;i.curr*e>i.count&&(i.curr=Math.ceil(i.count/e)),i.limit=e,t.render()}),u&&s.on(u,"click",function(){c()})}},u.prototype.skip=function(e){if(e){var a=this,t=e[n]("input")[0];t&&s.on(t,"keyup",function(t){var n=this.value,i=t.keyCode;/^(37|38|39|40)$/.test(i)||(/\D/.test(n)&&(this.value=n.replace(/\D/,"")),13===i&&a.jump(e,!0))})}},u.prototype.render=function(e){var n=this,i=n.config,r=n.type(),u=n.view();2===r?i.elem&&(i.elem.innerHTML=u):3===r?i.elem.html(u):a[t](i.elem)&&(a[t](i.elem).innerHTML=u),i.jump&&i.jump(i,e);var s=a[t]("layui-laypage-"+i.index);n.jump(s),i.hash&&!e&&(location.hash="!"+i.hash+"="+i.curr),n.skip(s)};var s={render:function(e){var a=new u(e);return a.index},index:layui.laypage?layui.laypage.index+1e4:0,on:function(e,a,t){return e.attachEvent?e.attachEvent("on"+a,function(a){a.target=a.srcElement,t.call(e,a)}):e.addEventListener(a,t,!1),this}};e(i,s)}); -------------------------------------------------------------------------------- /public/js/roles.js: -------------------------------------------------------------------------------- 1 | layui.use(['table','element','form','jquery'], function(){ 2 | var table = layui.table 3 | ,form = layui.form 4 | ,$ = layui.jquery; 5 | //第一个实例 6 | table.render({ 7 | elem: '#roles_table' 8 | ,url: '/admin/api/roles' //数据接口 9 | ,limit: 5 10 | ,page: true //开启分页 11 | ,cols: [[ //表头 12 | {fixed: 'left',checkbox : true} 13 | ,{field: 'id', title: 'ID', width:50, align:'center',sort: true} 14 | ,{field: 'name', title: '角色名称', align:'center',width:150} 15 | ,{field: 'permission', title: '权限名称', align:'center'} 16 | ,{title: '操作', width:150, align:'center', toolbar: '#roles_tools'} //这里的toolbar值是模板元素的选择器 17 | ]] 18 | }); 19 | //监听工具条 20 | table.on('tool(roles_table)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值" 21 | var data = obj.data; //获得当前行数据 22 | var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) 23 | var tr = obj.tr; //获得当前行 tr 的DOM对象 24 | 25 | if (layEvent === 'del') { //删除 26 | console.log('detail'); 27 | console.log(obj); 28 | layer.confirm('真的删除行么', function (index) { 29 | 30 | layer.close(index); 31 | //向服务端发送删除指令 32 | $.ajax({ 33 | type: 'DELETE', 34 | dataType: 'json', 35 | url: '/admin/roles/'+obj.data.id, 36 | success: function(data) { 37 | if(data.code==1){ 38 | layer.alert(data.msg,{icon: 1}); 39 | obj.del(); //删除对应行(tr)的DOM结构,并更新缓存 40 | }else{ 41 | layer.alert(data.msg,{icon: 2}); 42 | } 43 | }, 44 | error : function (msg) { 45 | console.log('error'); 46 | var json=JSON.parse(msg.responseText); 47 | $.each(json.errors,function(index,error){ 48 | $.each(error,function(key,value){ 49 | layer.alert(value,{icon: 2}); 50 | }); 51 | }); 52 | } 53 | }); 54 | }); 55 | } else if (layEvent === 'edit') { //编辑 56 | //do something 57 | console.log(obj); 58 | location.href= '/admin/roles/'+obj.data.id+'/edit'; 59 | 60 | // //同步更新缓存对应的值 61 | // obj.update({ 62 | // username: '123' 63 | // , title: 'xxx' 64 | // }); 65 | } 66 | }); 67 | 68 | //自定义验证规则 69 | form.verify({ 70 | name: function(value, item){ //value:表单的值、item:表单的DOM对象 71 | if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){ 72 | return '用户名不能有特殊字符'; 73 | } 74 | if(/(^\_)|(\__)|(\_+$)/.test(value)){ 75 | return '用户名首尾不能出现下划线\'_\''; 76 | } 77 | if(/^\d+\d+\d$/.test(value)){ 78 | return '用户名不能全为数字'; 79 | } 80 | }, 81 | }); 82 | //监听提交 83 | form.on('submit(role)', function(data) { 84 | $.ajax({ 85 | type: 'post', 86 | dataType: 'json', 87 | url: data.form.action, 88 | data: data.field, 89 | success: function(data) { 90 | if(data.code==1){ 91 | layer.alert(data.msg,{icon: 1}); 92 | location.href = '/admin/roles'; 93 | }else{ 94 | layer.alert(data.msg,{icon: 2}); 95 | } 96 | }, 97 | error : function (msg) { 98 | console.log('error'); 99 | var json=JSON.parse(msg.responseText); 100 | $.each(json.errors,function(index,error){ 101 | $.each(error,function(key,value){ 102 | layer.alert(value,{icon: 2}); 103 | }); 104 | }); 105 | } 106 | }); 107 | return false; 108 | }); 109 | }); -------------------------------------------------------------------------------- /public/js/index.js: -------------------------------------------------------------------------------- 1 | var element; 2 | var $; 3 | layui.use(['element','jquery','form', 'layedit'],function(){ 4 | element = layui.element; 5 | $ = layui.jquery; 6 | var form = layui.form 7 | ,layer = layui.layer 8 | ,layedit = layui.layedit; 9 | 10 | 11 | // //自定义验证规则 12 | // form.verify({ 13 | // title: function(value){ 14 | // if(value.length < 5){ 15 | // return '标题至少得5个字符啊'; 16 | // } 17 | // } 18 | // ,pass: [/(.+){6,12}$/, '密码必须6到12位'] 19 | // ,content: function(value){ 20 | // layedit.sync(editIndex); 21 | // } 22 | // }); 23 | // 24 | // //监听指定开关 25 | // form.on('switch(switchTest)', function(data){ 26 | // if(this.checked){ 27 | // url='/admin/up'; 28 | // }else{ 29 | // url='/admin/down'; 30 | // } 31 | // $.ajax({ 32 | // type: 'get', 33 | // dataType: 'json', 34 | // url: url, 35 | // success: function(data) { 36 | // layer.alert(data.msg,{icon: 1}); 37 | // }, 38 | // error: function(data) { 39 | // layer.msg('异常错误', {icon: 2}); 40 | // } 41 | // }); 42 | // layer.tips('温馨提示:请注意开关状态代表网站前台的状态,后台不受影响', data.othis) 43 | // }); 44 | // 45 | // //监听提交 46 | // form.on('submit(config)', function(data){ 47 | // data.field.status=data.field.status ? '1': '0';//开关是否开启,true或者false 48 | // 49 | // $.ajax({ 50 | // type: 'post', 51 | // dataType: 'json', 52 | // url: data.form.action, 53 | // data: data.field, 54 | // success: function(data) { 55 | // if(data.code==1){ 56 | // layer.alert(data.msg,{icon: 1}); 57 | // }else{ 58 | // layer.alert(data.msg,{icon: 2}); 59 | // 60 | // } 61 | // }, 62 | // error : function (msg) { 63 | // var json=JSON.parse(msg.responseText); 64 | // $.each(json.errors,function(index,error){ 65 | // $.each(error,function(key,value){ 66 | // layer.alert(value,{icon: 2}); 67 | // }); 68 | // }); 69 | // }, 70 | // }); 71 | // return false; 72 | // }); 73 | 74 | //左侧导航根据一级菜单关闭其它一级菜单 75 | $('ul.layui-nav li').click(function() { 76 | $('ul.layui-nav li').removeClass('layui-nav-itemed'); 77 | $(this).addClass('layui-nav-itemed'); 78 | }); 79 | 80 | //监听左侧菜单点击 81 | element.on('nav(left-menu)', function(elem){ 82 | addTab(elem[0].innerText,elem[0].attributes[1].nodeValue,elem[0].id); 83 | }); 84 | //监听tab选项卡切换 85 | element.on('tab(tab-switch)', function(data){ 86 | if(data.elem.context.attributes != undefined){ 87 | var id = data.elem.context.attributes[0].nodeValue; 88 | layui.each($(".layui-nav-child"), function () { 89 | $(this).find("dd").removeClass("layui-this"); 90 | }); 91 | $("#"+id).attr("class","layui-this"); 92 | } 93 | }); 94 | }); 95 | 96 | /** 97 | * 新增tab选项卡,如果已经存在则打开已经存在的,不存在则新增 98 | * @param tabTitle 选项卡标题名称 99 | * @param tabUrl 选项卡链接的页面URL 100 | * @param tabId 选项卡id 101 | */ 102 | function addTab(tabTitle,tabUrl,tabId){ 103 | if ($(".layui-tab-title li[lay-id=" + tabId + "]").length > 0) { 104 | element.tabChange('tab-switch', tabId); 105 | }else{ 106 | element.tabAdd('tab-switch', { 107 | title: tabTitle 108 | ,content: '' // 选项卡内容,支持传入html 109 | ,id: tabId //选项卡标题的lay-id属性值 110 | }); 111 | element.tabChange('tab-switch', tabId); //切换到新增的tab上 112 | } 113 | } 114 | 115 | /** 116 | * ifrme自适应页面高度,需要设定min-height 117 | * @param iframe 118 | */ 119 | function setIframeHeight(iframe) { 120 | if (iframe) { 121 | var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; 122 | if (iframeWin.document.body) { 123 | iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight; 124 | } 125 | } 126 | }; -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Database Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here are each of the database connections setup for your application. 24 | | Of course, examples of configuring each database platform that is 25 | | supported by Laravel is shown below to make development simple. 26 | | 27 | | 28 | | All database work in Laravel is done through the PHP PDO facilities 29 | | so make sure you have the driver for your particular database of 30 | | choice installed on your machine before you begin development. 31 | | 32 | */ 33 | 34 | 'connections' => [ 35 | 36 | 'sqlite' => [ 37 | 'driver' => 'sqlite', 38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 39 | 'prefix' => '', 40 | ], 41 | 42 | 'mysql' => [ 43 | 'driver' => 'mysql', 44 | 'host' => env('DB_HOST', '127.0.0.1'), 45 | 'port' => env('DB_PORT', '3306'), 46 | 'database' => env('DB_DATABASE', 'forge'), 47 | 'username' => env('DB_USERNAME', 'forge'), 48 | 'password' => env('DB_PASSWORD', ''), 49 | 'unix_socket' => env('DB_SOCKET', ''), 50 | 'charset' => 'utf8mb4', 51 | 'collation' => 'utf8mb4_unicode_ci', 52 | 'prefix' => '', 53 | 'strict' => true, 54 | 'engine' => null, 55 | ], 56 | 57 | 'pgsql' => [ 58 | 'driver' => 'pgsql', 59 | 'host' => env('DB_HOST', '127.0.0.1'), 60 | 'port' => env('DB_PORT', '5432'), 61 | 'database' => env('DB_DATABASE', 'forge'), 62 | 'username' => env('DB_USERNAME', 'forge'), 63 | 'password' => env('DB_PASSWORD', ''), 64 | 'charset' => 'utf8', 65 | 'prefix' => '', 66 | 'schema' => 'public', 67 | 'sslmode' => 'prefer', 68 | ], 69 | 70 | 'sqlsrv' => [ 71 | 'driver' => 'sqlsrv', 72 | 'host' => env('DB_HOST', 'localhost'), 73 | 'port' => env('DB_PORT', '1433'), 74 | 'database' => env('DB_DATABASE', 'forge'), 75 | 'username' => env('DB_USERNAME', 'forge'), 76 | 'password' => env('DB_PASSWORD', ''), 77 | 'charset' => 'utf8', 78 | 'prefix' => '', 79 | ], 80 | 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Migration Repository Table 86 | |-------------------------------------------------------------------------- 87 | | 88 | | This table keeps track of all the migrations that have already run for 89 | | your application. Using this information, we can determine which of 90 | | the migrations on disk haven't actually been run in the database. 91 | | 92 | */ 93 | 94 | 'migrations' => 'migrations', 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Redis Databases 99 | |-------------------------------------------------------------------------- 100 | | 101 | | Redis is an open source, fast, and advanced key-value store that also 102 | | provides a richer set of commands than a typical key-value systems 103 | | such as APC or Memcached. Laravel makes it easy to dig right in. 104 | | 105 | */ 106 | 107 | 'redis' => [ 108 | 109 | 'client' => 'predis', 110 | 111 | 'default' => [ 112 | 'host' => env('REDIS_HOST', '127.0.0.1'), 113 | 'password' => env('REDIS_PASSWORD', null), 114 | 'port' => env('REDIS_PORT', 6379), 115 | 'database' => 0, 116 | ], 117 | 118 | ], 119 | 120 | ]; 121 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => [ 59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 60 | 'name' => env('MAIL_FROM_NAME', 'Example'), 61 | ], 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | E-Mail Encryption Protocol 66 | |-------------------------------------------------------------------------- 67 | | 68 | | Here you may specify the encryption protocol that should be used when 69 | | the application send e-mail messages. A sensible default using the 70 | | transport layer security protocol should provide great security. 71 | | 72 | */ 73 | 74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | SMTP Server Username 79 | |-------------------------------------------------------------------------- 80 | | 81 | | If your SMTP server requires a username for authentication, you should 82 | | set it here. This will get used to authenticate with your server on 83 | | connection. You may also set the "password" value below this one. 84 | | 85 | */ 86 | 87 | 'username' => env('MAIL_USERNAME'), 88 | 89 | 'password' => env('MAIL_PASSWORD'), 90 | 91 | /* 92 | |-------------------------------------------------------------------------- 93 | | Sendmail System Path 94 | |-------------------------------------------------------------------------- 95 | | 96 | | When using the "sendmail" driver to send e-mails, we will need to know 97 | | the path to where Sendmail lives on this server. A default path has 98 | | been provided here, which will work well on most of your systems. 99 | | 100 | */ 101 | 102 | 'sendmail' => '/usr/sbin/sendmail -bs', 103 | 104 | /* 105 | |-------------------------------------------------------------------------- 106 | | Markdown Mail Settings 107 | |-------------------------------------------------------------------------- 108 | | 109 | | If you are using Markdown based email rendering, you may configure your 110 | | theme and component paths here, allowing you to customize the design 111 | | of the emails. Or, you may simply stick with the Laravel defaults! 112 | | 113 | */ 114 | 115 | 'markdown' => [ 116 | 'theme' => 'default', 117 | 118 | 'paths' => [ 119 | resource_path('views/vendor/mail'), 120 | ], 121 | ], 122 | 123 | ]; 124 | -------------------------------------------------------------------------------- /public/js/users.js: -------------------------------------------------------------------------------- 1 | layui.use(['table','form','jquery'], function(){ 2 | var table = layui.table 3 | ,form = layui.form 4 | ,$ = layui.jquery; 5 | //第一个实例 6 | table.render({ 7 | elem: '#users_table' 8 | ,url: '/admin/api/users' //数据接口 9 | ,limit: 5 10 | ,page: true //开启分页 11 | ,cols: [[ //表头 12 | {fixed: 'left',checkbox : true} 13 | ,{field: 'id', title: 'ID', width:50, align:'center',sort: true} 14 | ,{field: 'name', title: '用户名', align:'center',width:150} 15 | ,{field: 'email', title: '邮箱', align:'center',width:190} 16 | ,{field: 'roles', title: '角色', align:'center',width:130} 17 | ,{field: 'created_at', title: '创建时间',align:'center', width: 165 ,sort: true} 18 | ,{field: 'updated_at', title: '更新时间',align:'center', width: 165, sort: true} 19 | ,{title: '操作', width:150, align:'center', toolbar: '#bartools'} //这里的toolbar值是模板元素的选择器 20 | ]] 21 | }); 22 | //监听工具条 23 | table.on('tool(users_table)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值" 24 | var data = obj.data; //获得当前行数据 25 | var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值) 26 | var tr = obj.tr; //获得当前行 tr 的DOM对象 27 | 28 | if (layEvent === 'del') { //删除 29 | console.log('detail'); 30 | console.log(obj); 31 | layer.confirm('真的删除行么', function (index) { 32 | 33 | layer.close(index); 34 | //向服务端发送删除指令 35 | $.ajax({ 36 | type: 'DELETE', 37 | dataType: 'json', 38 | url: '/admin/users/'+obj.data.id, 39 | success: function(data) { 40 | if(data.code==1){ 41 | layer.alert(data.msg,{icon: 1}); 42 | obj.del(); //删除对应行(tr)的DOM结构,并更新缓存 43 | }else{ 44 | layer.alert(data.msg,{icon: 2}); 45 | } 46 | }, 47 | error : function (msg) { 48 | console.log('error'); 49 | var json=JSON.parse(msg.responseText); 50 | $.each(json.errors,function(index,error){ 51 | $.each(error,function(key,value){ 52 | layer.alert(value,{icon: 2}); 53 | }); 54 | }); 55 | } 56 | }); 57 | }); 58 | } else if (layEvent === 'edit') { //编辑 59 | //do something 60 | location.href= '/admin/users/'+obj.data.id+'/edit'; 61 | 62 | // //同步更新缓存对应的值 63 | // obj.update({ 64 | // username: '123' 65 | // , title: 'xxx' 66 | // }); 67 | } 68 | }); 69 | 70 | //自定义验证规则 71 | form.verify({ 72 | name: function(value, item){ //value:表单的值、item:表单的DOM对象 73 | if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){ 74 | return '用户名不能有特殊字符'; 75 | } 76 | if(/(^\_)|(\__)|(\_+$)/.test(value)){ 77 | return '用户名首尾不能出现下划线\'_\''; 78 | } 79 | if(/^\d+\d+\d$/.test(value)){ 80 | return '用户名不能全为数字'; 81 | } 82 | }, 83 | //我们既支持上述函数式的方式,也支持下述数组的形式 84 | //数组的两个值分别代表:[正则匹配、匹配不符时的提示文字] 85 | confirmpwd : function(value,item){ 86 | if($('input[name=password]').val()!==value){ 87 | return '两次密码输入不一致!'; 88 | } 89 | } 90 | }); 91 | //监听提交 92 | form.on('submit(user)', function(data){ 93 | $.ajax({ 94 | type: 'post', 95 | dataType: 'json', 96 | url: data.form.action, 97 | data: data.field, 98 | success: function(data) { 99 | if(data.code==1){ 100 | layer.alert(data.msg,{icon: 1}); 101 | location.href = '/admin/users'; 102 | }else{ 103 | layer.alert(data.msg,{icon: 2}); 104 | } 105 | }, 106 | error : function (msg) { 107 | console.log('error'); 108 | var json=JSON.parse(msg.responseText); 109 | $.each(json.errors,function(index,error){ 110 | $.each(error,function(key,value){ 111 | layer.alert(value,{icon: 2}); 112 | }); 113 | }); 114 | } 115 | }); 116 | return false; 117 | }); 118 | }); -------------------------------------------------------------------------------- /public/layui/layui.js: -------------------------------------------------------------------------------- 1 | /** layui-v2.2.45 MIT License By http://www.layui.com */ 2 | ;!function(e){"use strict";var t=document,o={modules:{},status:{},timeout:10,event:{}},n=function(){this.v="2.2.45"},r=function(){var e=t.currentScript?t.currentScript.src:function(){for(var e,o=t.scripts,n=o.length-1,r=n;r>0;r--)if("interactive"===o[r].readyState){e=o[r].src;break}return e||o[n].src}();return e.substring(0,e.lastIndexOf("/")+1)}(),i=function(t){e.console&&console.error&&console.error("Layui hint: "+t)},a="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),u={layer:"modules/layer",laydate:"modules/laydate",laypage:"modules/laypage",laytpl:"modules/laytpl",layim:"modules/layim",layedit:"modules/layedit",form:"modules/form",upload:"modules/upload",tree:"modules/tree",table:"modules/table",element:"modules/element",util:"modules/util",flow:"modules/flow",carousel:"modules/carousel",code:"modules/code",jquery:"modules/jquery",mobile:"modules/mobile","layui.all":"../layui.all"};n.prototype.cache=o,n.prototype.define=function(e,t){var n=this,r="function"==typeof e,i=function(){return"function"==typeof t&&t(function(e,t){layui[e]=t,o.status[e]=!0}),this};return r&&(t=e,e=[]),layui["layui.all"]||!layui["layui.all"]&&layui["layui.mobile"]?i.call(n):(n.use(e,i),n)},n.prototype.use=function(e,n,l){function s(e,t){var n="PLaySTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/;("load"===e.type||n.test((e.currentTarget||e.srcElement).readyState))&&(o.modules[f]=t,d.removeChild(v),function r(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void(o.status[f]?c():setTimeout(r,4))}())}function c(){l.push(layui[f]),e.length>1?p.use(e.slice(1),n,l):"function"==typeof n&&n.apply(layui,l)}var p=this,y=o.dir=o.dir?o.dir:r,d=t.getElementsByTagName("head")[0];e="string"==typeof e?[e]:e,window.jQuery&&jQuery.fn.on&&(p.each(e,function(t,o){"jquery"===o&&e.splice(t,1)}),layui.jquery=layui.$=jQuery);var f=e[0],m=0;if(l=l||[],o.host=o.host||(y.match(/\/\/([\s\S]+?)\//)||["//"+location.host+"/"])[0],0===e.length||layui["layui.all"]&&u[f]||!layui["layui.all"]&&layui["layui.mobile"]&&u[f])return c(),p;if(o.modules[f])!function g(){return++m>1e3*o.timeout/4?i(f+" is not a valid module"):void("string"==typeof o.modules[f]&&o.status[f]?c():setTimeout(g,4))}();else{var v=t.createElement("script"),h=(u[f]?y+"lay/":/^\{\/\}/.test(p.modules[f])?"":o.base||"")+(p.modules[f]||f)+".js";h=h.replace(/^\{\/\}/,""),v.async=!0,v.charset="utf-8",v.src=h+function(){var e=o.version===!0?o.v||(new Date).getTime():o.version||"";return e?"?v="+e:""}(),d.appendChild(v),!v.attachEvent||v.attachEvent.toString&&v.attachEvent.toString().indexOf("[native code")<0||a?v.addEventListener("load",function(e){s(e,h)},!1):v.attachEvent("onreadystatechange",function(e){s(e,h)}),o.modules[f]=h}return p},n.prototype.getStyle=function(t,o){var n=t.currentStyle?t.currentStyle:e.getComputedStyle(t,null);return n[n.getPropertyValue?"getPropertyValue":"getAttribute"](o)},n.prototype.link=function(e,n,r){var a=this,u=t.createElement("link"),l=t.getElementsByTagName("head")[0];"string"==typeof n&&(r=n);var s=(r||e).replace(/\.|\//g,""),c=u.id="layuicss-"+s,p=0;return u.rel="stylesheet",u.href=e+(o.debug?"?v="+(new Date).getTime():""),u.media="all",t.getElementById(c)||l.appendChild(u),"function"!=typeof n?a:(function y(){return++p>1e3*o.timeout/100?i(e+" timeout"):void(1989===parseInt(a.getStyle(t.getElementById(c),"width"))?function(){n()}():setTimeout(y,100))}(),a)},n.prototype.addcss=function(e,t,n){return layui.link(o.dir+"css/"+e,t,n)},n.prototype.img=function(e,t,o){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,o(e)}))},n.prototype.config=function(e){e=e||{};for(var t in e)o[t]=e[t];return this},n.prototype.modules=function(){var e={};for(var t in u)e[t]=u[t];return e}(),n.prototype.extend=function(e){var t=this;e=e||{};for(var o in e)t[o]||t.modules[o]?i("模块名 "+o+" 已被占用"):t.modules[o]=e[o];return t},n.prototype.router=function(e){var t=this,e=e||location.hash,o={path:[],search:{},hash:(e.match(/[^#](#.*$)/)||[])[1]||""};return/^#\//.test(e)?(e=e.replace(/^#\//,"").replace(/([^#])(#.*$)/,"$1").split("/")||[],t.each(e,function(e,t){/^\w+=/.test(t)?function(){t=t.split("="),o.search[t[0]]=t[1]}():o.path.push(t)}),o):o},n.prototype.data=function(t,o){if(t=t||"layui",e.JSON&&e.JSON.parse){if(null===o)return delete localStorage[t];o="object"==typeof o?o:{key:o};try{var n=JSON.parse(localStorage[t])}catch(r){var n={}}return"value"in o&&(n[o.key]=o.value),o.remove&&delete n[o.key],localStorage[t]=JSON.stringify(n),o.key?n[o.key]:n}},n.prototype.device=function(t){var o=navigator.userAgent.toLowerCase(),n=function(e){var t=new RegExp(e+"/([^\\s\\_\\-]+)");return e=(o.match(t)||[])[1],e||!1},r={os:function(){return/windows/.test(o)?"windows":/linux/.test(o)?"linux":/iphone|ipod|ipad|ios/.test(o)?"ios":/mac/.test(o)?"mac":void 0}(),ie:function(){return!!(e.ActiveXObject||"ActiveXObject"in e)&&((o.match(/msie\s(\d+)/)||[])[1]||"11")}(),weixin:n("micromessenger")};return t&&!r[t]&&(r[t]=n(t)),r.android=/android/.test(o),r.ios="ios"===r.os,r},n.prototype.hint=function(){return{error:i}},n.prototype.each=function(e,t){var o,n=this;if("function"!=typeof t)return n;if(e=e||[],e.constructor===Object){for(o in e)if(t.call(e[o],o,e[o]))break}else for(o=0;oi?1:r"].join("")),o=t.elem.next();(o.hasClass(u)||o.hasClass(c))&&o.remove(),a.ie&&a.ie<10&&t.elem.wrap('
    '),e.isFile()?(e.elemFile=t.elem,t.field=t.elem[0].name):t.elem.after(n),a.ie&&a.ie<10&&e.initIE()},p.prototype.initIE=function(){var e=this,t=e.config,n=i(''),a=i(['
    ',"
    "].join(""));i("#"+f)[0]||i("body").append(n),t.elem.next().hasClass(f)||(e.elemFile.wrap(a),t.elem.next("."+f).append(function(){var e=[];return layui.each(t.data,function(i,t){e.push('')}),e.join("")}()))},p.prototype.msg=function(e){return t.msg(e,{icon:2,shift:6})},p.prototype.isFile=function(){var e=this.config.elem[0];if(e)return"input"===e.tagName.toLocaleLowerCase()&&"file"===e.type},p.prototype.preview=function(e){var i=this;window.FileReader&&layui.each(i.chooseFiles,function(i,t){var n=new FileReader;n.readAsDataURL(t),n.onload=function(){e&&e(i,t,this.result)}})},p.prototype.upload=function(e,t){var n,o=this,l=o.config,r=o.elemFile[0],u=function(){var t=0,n=0,a=e||o.files||o.chooseFiles||r.files,u=function(){l.multiple&&t+n===o.fileLength&&"function"==typeof l.allDone&&l.allDone({total:o.fileLength,successful:t,aborted:n})};layui.each(a,function(e,a){var r=new FormData;r.append(l.field,a),layui.each(l.data,function(e,i){r.append(e,i)}),i.ajax({url:l.url,type:l.method,data:r,contentType:!1,processData:!1,dataType:"json",success:function(i){t++,d(e,i),u()},error:function(){n++,o.msg("请求上传接口出现异常"),m(e),u()}})})},c=function(){var e=i("#"+f);o.elemFile.parent().submit(),clearInterval(p.timer),p.timer=setInterval(function(){var i,t=e.contents().find("body");try{i=t.text()}catch(n){o.msg("获取上传后的响应信息出现异常"),clearInterval(p.timer),m()}i&&(clearInterval(p.timer),t.html(""),d(0,i))},30)},d=function(e,i){if(o.elemFile.next("."+s).remove(),r.value="","object"!=typeof i)try{i=JSON.parse(i)}catch(t){return i={},o.msg("请对上传接口返回有效JSON")}"function"==typeof l.done&&l.done(i,e||0,function(e){o.upload(e)})},m=function(e){l.auto&&(r.value=""),"function"==typeof l.error&&l.error(e||0,function(e){o.upload(e)})},h=l.exts,v=function(){var i=[];return layui.each(e||o.chooseFiles,function(e,t){i.push(t.name)}),i}(),g={preview:function(e){o.preview(e)},upload:function(e,i){var t={};t[e]=i,o.upload(t)},pushFile:function(){return o.files=o.files||{},layui.each(o.chooseFiles,function(e,i){o.files[e]=i}),o.files}},y=function(){return"choose"===t?l.choose&&l.choose(g):(l.before&&l.before(g),a.ie?a.ie>9?u():c():void u())};if(v=0===v.length?r.value.match(/[^\/\\]+\..+/g)||[]||"":v,0!==v.length){switch(l.accept){case"file":if(h&&!RegExp("\\w\\.("+h+")$","i").test(escape(v)))return o.msg("选择的文件中包含不支持的格式"),r.value="";break;case"video":if(!RegExp("\\w\\.("+(h||"avi|mp4|wma|rmvb|rm|flash|3gp|flv")+")$","i").test(escape(v)))return o.msg("选择的视频中包含不支持的格式"),r.value="";break;case"audio":if(!RegExp("\\w\\.("+(h||"mp3|wav|mid")+")$","i").test(escape(v)))return o.msg("选择的音频中包含不支持的格式"),r.value="";break;default:if(layui.each(v,function(e,i){RegExp("\\w\\.("+(h||"jpg|png|gif|bmp|jpeg$")+")","i").test(escape(i))||(n=!0)}),n)return o.msg("选择的图片中包含不支持的格式"),r.value=""}if(o.fileLength=function(){var i=0,t=e||o.files||o.chooseFiles||r.files;return layui.each(t,function(){i++}),i}(),l.number&&o.fileLength>l.number)return o.msg("同时最多只能上传的数量为:"+l.number);if(l.size>0&&!(a.ie&&a.ie<10)){var F;if(layui.each(o.chooseFiles,function(e,i){if(i.size>1024*l.size){var t=l.size/1024;t=t>=1?Math.floor(t)+(t%1>0?t.toFixed(1):0)+"MB":l.size+"KB",r.value="",F=t}}),F)return o.msg("文件不能超过"+F)}y()}},p.prototype.events=function(){var e=this,t=e.config,o=function(i){e.chooseFiles={},layui.each(i,function(i,t){var n=(new Date).getTime();e.chooseFiles[n+"-"+i]=t})},l=function(i,n){var a=e.elemFile,o=i.length>1?i.length+"个文件":(i[0]||{}).name||a[0].value.match(/[^\/\\]+\..+/g)||[]||"";a.next().hasClass(s)&&a.next().remove(),e.upload(null,"choose"),e.isFile()||t.choose||a.after(''+o+"")};t.elem.off("upload.start").on("upload.start",function(){var a=i(this),o=a.attr("lay-data");if(o)try{o=new Function("return "+o)(),e.config=i.extend({},t,o)}catch(l){n.error("Upload element property lay-data configuration item has a syntax error: "+o)}e.config.item=a,e.elemFile[0].click()}),a.ie&&a.ie<10||t.elem.off("upload.over").on("upload.over",function(){var e=i(this);e.attr("lay-over","")}).off("upload.leave").on("upload.leave",function(){var e=i(this);e.removeAttr("lay-over")}).off("upload.drop").on("upload.drop",function(n,a){var r=i(this),u=a.originalEvent.dataTransfer.files||[];r.removeAttr("lay-over"),o(u),t.auto?e.upload(u):l(u)}),e.elemFile.off("upload.change").on("upload.change",function(){var i=this.files||[];o(i),t.auto?e.upload():l(i)}),t.bindAction.off("upload.action").on("upload.action",function(){e.upload()}),t.elem.data("haveEvents")||(e.elemFile.on("change",function(){i(this).trigger("upload.change")}),t.elem.on("click",function(){e.isFile()||i(this).trigger("upload.start")}),t.drag&&t.elem.on("dragover",function(e){e.preventDefault(),i(this).trigger("upload.over")}).on("dragleave",function(e){i(this).trigger("upload.leave")}).on("drop",function(e){e.preventDefault(),i(this).trigger("upload.drop",e)}),t.bindAction.on("click",function(){i(this).trigger("upload.action")}),t.elem.data("haveEvents",!0))},o.render=function(e){var i=new p(e);return l.call(i)},e(r,o)}); --------------------------------------------------------------------------------