Level 20
Maybe you have to clear route cache, so execute this
php artisan optimize
Admin part of the site resides on admin.domain.test, while publicly accessible website uses domain.test.
Whenever I use route('name') to generate link from admin part to the public site, the URL looks like admin.domain.test/article/article-title, instead of domain.test/article/article-title.
My subdomain route group is at the very top of the route file, everything else is below.
// Admin
Route::domain('admin.domain.test')->name('admin.')->middleware('auth')->group(function () {
Route::get('/', [AdminController::class, 'index'])->name('index');
Route::resources([
'articles' => ArticleAdminController::class,
]);
});
// Public
Route::get('/article/{article}', ArticleController::class)->name('article.show');
I am using route() function in my admin Blade templates like this:
<a href="{{ route('article.show', ['article' => $article->slug]) }}" title="{{ $article->title }}">{{ $article->title }}</a>
How can I get correct link (domain.test/article/article-title)?
Please or to participate in this conversation.