Skip to content

Commit 82f77b4

Browse files
Merge pull request #6 from Laravel-Lang/1.x
Middleware renamed to more appropriate names
2 parents c041415 + 0fe4b63 commit 82f77b4

6 files changed

+16
-16
lines changed

src/Middlewares/CookiesLocale.php src/Middlewares/LocalizationByCookie.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Illuminate\Http\Request;
88

9-
class CookiesLocale extends Middleware
9+
class LocalizationByCookie extends Middleware
1010
{
1111
protected function detect(Request $request): bool|float|int|string|null
1212
{

src/Middlewares/HeaderLocale.php src/Middlewares/LocalizationByHeader.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Illuminate\Http\Request;
88

9-
class HeaderLocale extends Middleware
9+
class LocalizationByHeader extends Middleware
1010
{
1111
protected function detect(Request $request): bool|float|int|string|null
1212
{

src/Middlewares/ParameterLocale.php src/Middlewares/LocalizationByParameter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Illuminate\Http\Request;
88

9-
class ParameterLocale extends Middleware
9+
class LocalizationByParameter extends Middleware
1010
{
1111
protected function detect(Request $request): bool|float|int|string|null
1212
{

src/Middlewares/ParameterRedirectLocale.php src/Middlewares/LocalizationByParameterWithRedirect.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use function array_merge;
1414
use function response;
1515

16-
class ParameterRedirectLocale extends Middleware
16+
class LocalizationByParameterWithRedirect extends Middleware
1717
{
1818
use KeyNames;
1919

src/Middlewares/SessionLocale.php src/Middlewares/LocalizationBySession.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Illuminate\Http\Request;
88

9-
class SessionLocale extends Middleware
9+
class LocalizationBySession extends Middleware
1010
{
1111
protected function detect(Request $request): bool|float|int|string|null
1212
{

tests/Concerns/Routes.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
namespace Tests\Concerns;
66

77
use Closure;
8-
use LaravelLang\Routes\Middlewares\CookiesLocale;
9-
use LaravelLang\Routes\Middlewares\HeaderLocale;
10-
use LaravelLang\Routes\Middlewares\ParameterLocale;
11-
use LaravelLang\Routes\Middlewares\ParameterRedirectLocale;
12-
use LaravelLang\Routes\Middlewares\SessionLocale;
8+
use LaravelLang\Routes\Middlewares\LocalizationByCookie;
9+
use LaravelLang\Routes\Middlewares\LocalizationByHeader;
10+
use LaravelLang\Routes\Middlewares\LocalizationByParameter;
11+
use LaravelLang\Routes\Middlewares\LocalizationByParameterWithRedirect;
12+
use LaravelLang\Routes\Middlewares\LocalizationBySession;
1313
use Tests\Constants\LocaleValue;
1414

1515
use function app;
@@ -24,31 +24,31 @@ public function setUpRoutes(): void
2424
->middleware('web')
2525
->group(function () {
2626
app('router')
27-
->middleware(ParameterLocale::class)
27+
->middleware(LocalizationByParameter::class)
2828
->get('path/{foo}/{locale?}', $this->jsonResponse())
2929
->name('via.parameter');
3030

3131
app('router')
32-
->middleware(ParameterRedirectLocale::class)
32+
->middleware(LocalizationByParameterWithRedirect::class)
3333
->get('redirect/{foo}/{locale?}', $this->jsonResponse())
3434
->name('via.parameter.redirect');
3535

3636
app('router')
37-
->middleware(ParameterRedirectLocale::class)
37+
->middleware(LocalizationByParameterWithRedirect::class)
3838
->get('not-named/redirect/{foo}/{locale?}', $this->jsonResponse());
3939

4040
app('router')
41-
->middleware(HeaderLocale::class)
41+
->middleware(LocalizationByHeader::class)
4242
->get('header/{foo}', $this->jsonResponse())
4343
->name('via.header');
4444

4545
app('router')
46-
->middleware(CookiesLocale::class)
46+
->middleware(LocalizationByCookie::class)
4747
->get('cookie/{foo}', $this->jsonResponse())
4848
->name('via.cookie');
4949

5050
app('router')
51-
->middleware(SessionLocale::class)
51+
->middleware(LocalizationBySession::class)
5252
->get('session/{foo}', $this->jsonResponse())
5353
->name('via.session');
5454
});

0 commit comments

Comments
 (0)