Extension Install
This commit is contained in:
25
extensions/Others/NavbarManager/routes/web.php
Normal file
25
extensions/Others/NavbarManager/routes/web.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Paymenter\Extensions\Others\NavbarManager\Models\NavbarLink;
|
||||
|
||||
Route::group(['prefix' => 'navbar'], function () {
|
||||
Route::get('/redirect/{linkId}', function($linkId) {
|
||||
try {
|
||||
$link = NavbarLink::findOrFail($linkId);
|
||||
if (!$link->is_active) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
if ($link->link_type === 'path' && $link->custom_path) {
|
||||
return redirect($link->custom_path);
|
||||
} elseif ($link->link_type === 'url' && $link->custom_url) {
|
||||
return redirect($link->custom_url);
|
||||
}
|
||||
|
||||
abort(404);
|
||||
} catch (\Exception $e) {
|
||||
abort(404);
|
||||
}
|
||||
})->name('navbar.redirect');
|
||||
});
|
||||
Reference in New Issue
Block a user