Mojito Admin 后台管理系统 项目简介
MojitoMojito 是一个基于 Laravel, Vue, Element构建的后台管理系统。截图特征可快速衍生多个后台系统内置角色,权限,用户,菜单管理OAuth 2.0,并支持多表鉴权完善的PHPUnit测试API 权限精确至路由,页面权限精取到按钮或链接前后端分离多标签页前端支持多语言配置简洁的布局要求Laravel >= 5.5.0Vue >= 2.5.17Element >= 2.4.6兼容性LaravelMojito5.5, 5.61.0.*5.71.1.*安装首先安装laravel,并且确保你配置了正确的数据库连接。composer require moell/mojito然后运行下面的命令来发布资源:php artisan mojito:install命令执行成功会生成配置文件,数据迁移和构建SPA的文件。在config/auth.php中添加相应的 guards 和 providers,如下:'guards' => [
...
'admin' => [
'driver' => 'passport',
'provider' => 'admin'
]
],
'providers' => [
...
'admin' => [
'driver' => 'eloquent',
'model' => \Moell\Mojito\Models\AdminUser::class,
]
],在 app/Http/Kernel.php 中 $routeMiddleware 属性添加路由中间 oauth.providers 和 mojito.permission,并将auth中间件替换为如下:class Kernel extends HttpKernel
{
protected $routeMiddleware = [
// 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \SMartins\PassportMultiauth\Http\Middleware\MultiAuthenticate::class,
'oauth.providers' => \SMartins\PassportMultiauth\Http\Middleware\AddCustomProvider::class,
'mojito.permission' => \Moell\Mojito\Http\Middleware\Authenticate::class,
];
}执行数据迁移,数据填充php artisan migrate
php artisan db:seed --class="Moell\Mojito\Database\MojitoTableSeeder"Passport 安装和配置php artisan passport:install执行成功后获取到相应的密码授予客户端的 ID 和 secret 并且配置到相对应的 resources/config/index.js :export default {
admin: {
authorize: {
clientId: ID,
clientSecret: secret
}
}安装 Javscript 依赖npm install
npm install -D vuex@^3.0.1 vue-router@^3.0.1 vue-i18n@^8.1.0 localforage@^1.7.2 element-ui@^2.4.6Mix 引入 admin.jsmix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
//.js('resources/js/admin.js', 'public/js') laravel5.7+
.js('resources/assets/js/admin.js', 'public/js')运行 Mix#npm run watch
npm run production登录url: http://localhost/mojito#/admin/loginemail: [email protected]: secret依赖开源软件LaravelVueElement UIlaravel/passportsmartins/passport-multiauthspatie/laravel-permissionorchestra/testbenchLicenseApache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html
...
'admin' => [
'driver' => 'passport',
'provider' => 'admin'
]
],
'providers' => [
...
'admin' => [
'driver' => 'eloquent',
'model' => \Moell\Mojito\Models\AdminUser::class,
]
],在 app/Http/Kernel.php 中 $routeMiddleware 属性添加路由中间 oauth.providers 和 mojito.permission,并将auth中间件替换为如下:class Kernel extends HttpKernel
{
protected $routeMiddleware = [
// 'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \SMartins\PassportMultiauth\Http\Middleware\MultiAuthenticate::class,
'oauth.providers' => \SMartins\PassportMultiauth\Http\Middleware\AddCustomProvider::class,
'mojito.permission' => \Moell\Mojito\Http\Middleware\Authenticate::class,
];
}执行数据迁移,数据填充php artisan migrate
php artisan db:seed --class="Moell\Mojito\Database\MojitoTableSeeder"Passport 安装和配置php artisan passport:install执行成功后获取到相应的密码授予客户端的 ID 和 secret 并且配置到相对应的 resources/config/index.js :export default {
admin: {
authorize: {
clientId: ID,
clientSecret: secret
}
}安装 Javscript 依赖npm install
npm install -D vuex@^3.0.1 vue-router@^3.0.1 vue-i18n@^8.1.0 localforage@^1.7.2 element-ui@^2.4.6Mix 引入 admin.jsmix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
//.js('resources/js/admin.js', 'public/js') laravel5.7+
.js('resources/assets/js/admin.js', 'public/js')运行 Mix#npm run watch
npm run production登录url: http://localhost/mojito#/admin/loginemail: [email protected]: secret依赖开源软件LaravelVueElement UIlaravel/passportsmartins/passport-multiauthspatie/laravel-permissionorchestra/testbenchLicenseApache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html