Skip to content

Instantly share code, notes, and snippets.

@koyablue
Created November 4, 2021 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koyablue/2a5bade46210839f30a9c987b32f1ff0 to your computer and use it in GitHub Desktop.
Save koyablue/2a5bade46210839f30a9c987b32f1ff0 to your computer and use it in GitHub Desktop.
<?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