prepared and gallery fixes
This commit is contained in:
@@ -26,6 +26,19 @@ class NewsController extends Controller
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
// redirect to canonical slug for SEO if available
|
||||
try {
|
||||
$correct = \Illuminate\Support\Str::slug($news->headline ?? 'news-' . $id);
|
||||
if ($slug !== $correct) {
|
||||
$qs = $request->getQueryString();
|
||||
$url = route('legacy.news.show', ['id' => $id, 'slug' => $correct]);
|
||||
if ($qs) $url .= '?' . $qs;
|
||||
return redirect($url, 301);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
try {
|
||||
$comments = DB::table('news_comment as c')
|
||||
->leftJoin('users as u', 'c.user_id', '=', 'u.user_id')
|
||||
|
||||
Reference in New Issue
Block a user