Skip to content

Commit 227d2b3

Browse files
committed
fix: update route names to include postType defaults for better clarity
1 parent d1b5762 commit 227d2b3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Models/PostType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function getFeatureCollectionName(string|PostTypeFeatures $feature): ?str
199199
*/
200200
public function getWebView(string $action = 'index'): string
201201
{
202-
return 'cms::web.post-type.' . $this->slug . '.' . $action;
202+
return 'web.post-type.' . $this->slug . '.' . $action;
203203
}
204204

205205
/**

src/Support/Routes.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,18 @@ public static function customPostType(
242242
$registrar->group(function () use ($postTypeSlug, $controller) {
243243
// Post Type Index
244244
Route::get($postTypeSlug, $controller . '@index')
245-
->name("{$postTypeSlug}.index");
245+
->name("{$postTypeSlug}.index")
246+
->defaults('postType', $postTypeSlug);
246247

247248
// Single Post View
248249
Route::get("{$postTypeSlug}/{post}", $controller . '@show')
249-
->name("{$postTypeSlug}.show");
250+
->name("{$postTypeSlug}.show")
251+
->defaults('postType', $postTypeSlug);
250252

251253
// Category Filter
252254
Route::get("{$postTypeSlug}/category/{category}", $controller . '@category')
253-
->name("{$postTypeSlug}.category");
255+
->name("{$postTypeSlug}.category")
256+
->defaults('postType', $postTypeSlug);
254257
});
255258
}
256259

0 commit comments

Comments
 (0)