From 568f8b552d3bea3344e027f9c7f0183f3c4c77f1 Mon Sep 17 00:00:00 2001 From: Egoist Date: Fri, 12 May 2023 05:33:47 +0300 Subject: [PATCH] Add config for redirect controller --- config/url-shortener.php | 7 +++++++ routes/redirect.php | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/url-shortener.php b/config/url-shortener.php index 9350faa..4d54aee 100644 --- a/config/url-shortener.php +++ b/config/url-shortener.php @@ -40,6 +40,13 @@ */ 'redirect_route_prefix' => 'r', + /** + * Redirect controller for redirections + * + * Default: \LaravelReady\UrlShortener\Http\Controllers\RedirectController::class + */ + 'redirect_controller' => \LaravelReady\UrlShortener\Http\Controllers\RedirectController::class, + /** * Emoji related settings */ diff --git a/routes/redirect.php b/routes/redirect.php index 9a332d2..a6231c6 100644 --- a/routes/redirect.php +++ b/routes/redirect.php @@ -2,8 +2,7 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Config; -use LaravelReady\UrlShortener\Http\Controllers\RedirectController; Route::name('url-shortener.redirect.')->prefix(Config::get('url-shortener.redirect_route_prefix', 'r'))->group(function () { - Route::get('{short_code}', RedirectController::class)->name('index'); + Route::get('{short_code}', Config::get('url-shortener.redirect_controller', \LaravelReady\UrlShortener\Http\Controllers\RedirectController::class))->name('index'); });