Mojito是一个基于Laravel,Vue,Element构建的后台管理系统。
截图特征可快速衍生多个后台系统
内置角色,权限,用户,菜单管理
OAuth2.0,并支持多表鉴权
完善的PHPUnit测试
API权限精确至路由,页面权限精取到按钮或链接
前后端分离
多标签页
前端支持多语言配置
简洁的布局
要求Laravel>=5.5.0
Vue>=2.5.17
Element>=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 migratephp 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 installnpm 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.js
mix.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 watchnpm run production登录
url: https://localhost/mojito#/admin/login
email: admin@gmail.com
password:secret
依赖开源软件Laravel
Vue
ElementUI
laravel/passport
smartins/passport-multiauth
spatie/laravel-permission
orchestra/testbench
LicenseApacheLicenseVersion2.0see https://www.apache.org/licenses/LICENSE-2.0.html
评论