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'); });