Updates
This commit is contained in:
parent
22d4a4edf6
commit
9943fb28dd
21
app/Http/Controllers/TranslationController.php
Normal file
21
app/Http/Controllers/TranslationController.php
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Session;
|
||||||
|
|
||||||
|
class TranslationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Change session locale
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function changeLocale(Request $request)
|
||||||
|
{
|
||||||
|
Session::put('locale', $request->inputLocale);
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,7 +26,6 @@ class Kernel extends HttpKernel
|
||||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
\App\Http\Middleware\TrimStrings::class,
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
\App\Http\Middleware\SetLocale::class,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +44,7 @@ class Kernel extends HttpKernel
|
||||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
LastSeen::class,
|
LastSeen::class,
|
||||||
CreditsDisplayName::class,
|
CreditsDisplayName::class,
|
||||||
|
\App\Http\Middleware\SetLocale::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Http\Middleware;
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
|
|
||||||
|
@ -12,8 +13,8 @@ class SetLocale
|
||||||
*
|
*
|
||||||
* Handle an incoming request.
|
* Handle an incoming request.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param Request $request
|
||||||
* @param \Closure $next
|
* @param Closure $next
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
public function handle($request, Closure $next)
|
||||||
|
|
|
@ -46,6 +46,18 @@
|
||||||
<li class="nav-item d-none d-sm-inline-block">
|
<li class="nav-item d-none d-sm-inline-block">
|
||||||
<a href="{{env('DISCORD_INVITE_URL')}}" class="nav-link" target="__blank">{{__('Discord')}}</a>
|
<a href="{{env('DISCORD_INVITE_URL')}}" class="nav-link" target="__blank">{{__('Discord')}}</a>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- Language Selection -->
|
||||||
|
<form method="post" action="{{route('changeLocale')}}">
|
||||||
|
@csrf
|
||||||
|
<select class="dropdown-item" id="inputLocale" name="inputLocale" onchange="this.form.submit()">
|
||||||
|
<option value="de">DE</option>
|
||||||
|
<option value="it">IT</option>
|
||||||
|
<option value="en">EN</option>
|
||||||
|
<option value="zh">ZH</option>
|
||||||
|
<option value="fr">FR</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
<!-- End Language Selection -->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- Right navbar links -->
|
<!-- Right navbar links -->
|
||||||
|
|
|
@ -19,6 +19,7 @@ use App\Http\Controllers\ProductController as FrontProductController;
|
||||||
use App\Http\Controllers\ProfileController;
|
use App\Http\Controllers\ProfileController;
|
||||||
use App\Http\Controllers\ServerController;
|
use App\Http\Controllers\ServerController;
|
||||||
use App\Http\Controllers\StoreController;
|
use App\Http\Controllers\StoreController;
|
||||||
|
use App\Http\Controllers\TranslationController;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
@ -75,6 +76,8 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
|
||||||
#voucher redeem
|
#voucher redeem
|
||||||
Route::post('/voucher/redeem', [VoucherController::class, 'redeem'])->middleware('throttle:5,1')->name('voucher.redeem');
|
Route::post('/voucher/redeem', [VoucherController::class, 'redeem'])->middleware('throttle:5,1')->name('voucher.redeem');
|
||||||
|
|
||||||
|
#switch language
|
||||||
|
Route::post('changelocale', [TranslationController::class, 'changeLocale'])->name('changeLocale');
|
||||||
#admin
|
#admin
|
||||||
Route::prefix('admin')->name('admin.')->middleware('admin')->group(function () {
|
Route::prefix('admin')->name('admin.')->middleware('admin')->group(function () {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue