Added unique redirection to user page with ID

https://example.com/u/{user_id}
This commit is contained in:
Julian Prieber 2023-10-08 17:45:49 +02:00
parent d85071e4d9
commit b79d5905e2
2 changed files with 14 additions and 0 deletions

View File

@ -96,6 +96,19 @@ class UserController extends Controller
return view('littlelink', ['userinfo' => $userinfo, 'information' => $information, 'links' => $links, 'littlelink_name' => $littlelink_name]);
}
//Redirect to user page
public function userRedirect(request $request)
{
$id = $request->id;
$user = User::select('littlelink_name')->where('id', $id)->value('littlelink_name');
if (empty($id)) {
return abort(404);
}
return redirect(url('@'.$user));
}
//Show littlelink page as home page if set in config
public function littlelinkhome(request $request)
{

View File

@ -93,6 +93,7 @@ Route::get('/pages/'.strtolower(footer('Privacy')), [AdminController::class, 'pa
Route::get('/pages/'.strtolower(footer('Contact')), [AdminController::class, 'pagesContact'])->name('pagesContact');
Route::get('/theme/@{littlelink}', [UserController::class, 'theme'])->name('theme');
Route::get('/vcard/{id?}', [UserController::class, 'vcard'])->name('vcard');
Route::get('/u/{id?}', [UserController::class, 'userRedirect'])->name('userRedirect');
Route::get('/demo-page', [App\Http\Controllers\HomeController::class, 'demo'])->name('demo');