Created
November 4, 2021 08:55
-
-
Save koyablue/2a5bade46210839f30a9c987b32f1ff0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Packages\FrontPage\Home\Presentation\Controllers; | |
use Illuminate\Http\Request; | |
use App\Http\Controllers\Controller; | |
use App\Packages\FrontPage\Home\UseCase\SetLocaleUseCase; | |
class LocaleController extends Controller | |
{ | |
private SetLocaleUseCase $setLocaleUseCase; | |
public function __construct(SetLocaleUseCase $setLocaleUseCase) | |
{ | |
$this->setLocaleUseCase = $setLocaleUseCase; | |
} | |
/** | |
* 言語変更 | |
* | |
* @param string $locale | |
* @return void | |
*/ | |
public function setLocaleSession(string $locale) | |
{ | |
$this->setLocaleUseCase->setLocale($locale); | |
$urlToRedirect = url()->previous(route('home')); | |
return redirect($urlToRedirect); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment