Mojito 是一個基於 Laravel, Vue, Element構建的後臺管理系統。php
github.com/moell-peng/… 歡迎使用和starcss
url: mojito.moell.cn/mojito#/adm…html
username: mojito@gmail.com前端
password: mojito-demovue
Laravel | Mojito |
---|---|
5.5, 5.6 | 1.0.* |
5.7 | 1.1.* |
首先安裝laravel,而且確保你配置了正確的數據庫鏈接。webpack
composer require moell/mojito
複製代碼
而後運行下面的命令來發布資源:laravel
php artisan mojito:install
複製代碼
命令執行成功會生成配置文件,數據遷移和構建SPA的文件。git
在config/auth.php
中添加相應的 guards 和 providers,以下:github
'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
中間件替換爲以下:web
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.6
複製代碼
將 admin.js 添加到 webpack.mix.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 watch
npm run production
複製代碼
登陸
url: http://localhost/mojito#/admin/login
email: admin@gmail.com
password: secret
Apache License Version 2.0 see www.apache.org/licenses/LI…