lopatin96 / lara-locale
1.0.11
2025-03-29 19:08 UTC
Requires
- php: >=8.3
Requires (Dev)
- orchestra/testbench: ^10.0
README
Installation
You can install this package via composer:
composer require lopatin96/lara-locale
Add middleware to bootstrap/app.php
->withMiddleware(function (Middleware $middleware) { $middleware->appendToGroup('web', [ SetLocale::class, ]); })
Fix your route
use Lopatin96\LaraLocale\Helpers\LocaleHelper; Route::get('/{locale?}', static function () { return view('welcome'); }) ->name('home') ->whereIn('locale', LocaleHelper::getAvailableLocales());