Skip to content

Commit 853ef09

Browse files
committed
fix #5 and add show-login-page and show-navbar config
1 parent ba4476a commit 853ef09

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ In `config/admin.php`
2626
],
2727
// default locale
2828
'default' => 'zh-CN',
29+
// if or not show multi-language login page, default is true
30+
'show-login-page' => true,
31+
// if or not show multi-language navbar, default is true
32+
'show-navbar' => true
2933
],
3034
],
3135
```

resources/views/login.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>{{config('admin.title')}} | {{ trans('admin.login') }}</title>
77
<!-- Tell the browser to be responsive to screen width -->
88
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
9-
9+
1010
@if(!is_null($favicon = Admin::favicon()))
1111
<link rel="shortcut icon" href="{{$favicon}}">
1212
@endif
@@ -110,7 +110,7 @@
110110
111111
$("#locale").change(function () {
112112
let locale = $('#locale option:selected').val();
113-
$.post(`/admin/locale`,{locale: locale}, function () {
113+
$.post("{{ admin_url('/locale') }}",{locale: locale}, function () {
114114
location.reload();
115115
})
116116
});

routes/web.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

33
use KevinSoft\MultiLanguage\Http\Controllers\MultiLanguageController;
4+
use KevinSoft\MultiLanguage\MultiLanguage;
45

56
Route::post('/locale', MultiLanguageController::class.'@locale');
6-
Route::get('auth/login', MultiLanguageController::class.'@getLogin');
7+
if(MultiLanguage::config("show-login-page", true)) {
8+
Route::get('auth/login', MultiLanguageController::class.'@getLogin');
9+
}

src/MultiLanguageServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function boot(MultiLanguage $extension)
3434

3535
# $this->app->make('Illuminate\Contracts\Http\Kernel')->prependMiddleware(Middlewares\MultiLanguageMiddleware::class);
3636
$this->app['router']->pushMiddlewareToGroup('web', Middlewares\MultiLanguageMiddleware::class);
37-
Admin::navbar()->add(new LanguageMenu());
37+
if(MultiLanguage::config("show-navbar", true)) {
38+
Admin::navbar()->add(new LanguageMenu());
39+
}
3840
}
39-
}
41+
}

0 commit comments

Comments
 (0)