Skip to content

Commit 9ed5d29

Browse files
author
Andrey Helldar
authored
Merge pull request #9 from TheDragonCode/1.x
Updated config file
2 parents 6752b36 + c9427b8 commit 9ed5d29

File tree

4 files changed

+38
-8
lines changed

4 files changed

+38
-8
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ app('router')->apiResource('authors/{author}/photos', Author\PhotoController::cl
106106
| PATCH | `/authors/123/photos/{photo}` | `authors.photos.patch` | `route('authors.photos.patch')` |
107107
| DELETE | `/authors/123/photos/{photo}` | `authors.photos.destroy` | `route('authors.photos.destroy')` |
108108

109+
### List of exclusions
110+
111+
By publishing a configuration file with the artisan command, you can explicitly specify a mask of route names that do not need to be translated:
112+
113+
```bash
114+
php artisan vendor:publish --provider="DragonCode\LaravelRouteNames\ServiceProvider"
115+
```
116+
109117
### Exceptions
110118

111119
```php

config/route.php

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,35 @@
33
declare(strict_types=1);
44

55
return [
6+
/*
7+
|--------------------------------------------------------------------------
8+
| Names
9+
|--------------------------------------------------------------------------
10+
|
11+
| This option determines the handling of route names.
12+
|
13+
*/
14+
615
'names' => [
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| Exclude Names
20+
|--------------------------------------------------------------------------
21+
|
22+
| This option specifies the names of the routes that will be excluded
23+
| from the conversion.
24+
|
25+
*/
26+
727
'exclude' => [
8-
'_debugbar.*',
9-
'_ignition.*',
10-
'horizon.*',
11-
'pretty-routes.*',
12-
'telescope.*',
28+
'__clockwork*',
29+
'_debugbar*',
30+
'_ignition*',
31+
'horizon*',
32+
'pretty-routes*',
33+
'sanctum*',
34+
'telescope*',
1335
],
1436
],
1537
];

tests/Concerns/Routes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function protectedRoutes(Router $router): void
118118
$router->get('routes', [Controller::class, 'prettyRoutesList'])->name('pretty-routes.list');
119119
$router->get('routes', [Controller::class, 'prettyRoutesClear'])->name('pretty-routes.clear');
120120

121-
$router->get('telescope/{view?}', [Controller::class, 'telescopeShow'])->name('telescope.show');
122-
$router->get('telescope/telescope-api/views/{telescopeEntryId}', [Controller::class, 'telescopeViewsShow'])->name('telescope.telescope-api.views.show');
121+
$router->get('telescope/{view?}', [Controller::class, 'telescopeShow'])->name('telescope');
122+
$router->get('telescope/telescope-api/views/{telescopeEntryId}', [Controller::class, 'telescopeViewsShow']);
123123
}
124124
}

tests/Routes/ProtectedRoutesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function testWeb(): void
1313
$this->assertSame('pretty-routes.list', $this->getRouteName('prettyRoutesList'));
1414
$this->assertSame('pretty-routes.clear', $this->getRouteName('prettyRoutesClear'));
1515

16-
$this->assertSame('telescope.show', $this->getRouteName('telescopeShow'));
16+
$this->assertSame('telescope', $this->getRouteName('telescopeShow'));
1717
$this->assertSame('telescope.telescope-api.views.show', $this->getRouteName('telescopeViewsShow'));
1818
}
1919
}

0 commit comments

Comments
 (0)