mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
32 lines
787 B
PHP
32 lines
787 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Session;
|
|
use App\Models\User;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Http\Request;
|
|
use App\Services\Repositories\UserRepository;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function index(UserRepository $users, Request $request)
|
|
{
|
|
return view('index')->with('user', $users->get(session('uid')));
|
|
}
|
|
|
|
public function locale($lang, Request $request)
|
|
{
|
|
if (Arr::exists(config('locales'), $lang)) {
|
|
Session::set('locale', $lang);
|
|
}
|
|
|
|
if (isset($_SERVER['HTTP_REFERER'])) {
|
|
return redirect('/')->setTargetUrl($_SERVER['HTTP_REFERER'])->withCookie('locale', $lang);
|
|
} else {
|
|
return redirect('/')->withCookie('locale', $lang);
|
|
}
|
|
}
|
|
|
|
}
|