Revert "Turned ll home page into one function"

This reverts commit b9c0b38260.
This commit is contained in:
Julian Prieber 2023-03-21 20:24:23 +01:00
parent 69bb84d78f
commit 8a21ddfff6
2 changed files with 19 additions and 7 deletions

View File

@ -77,14 +77,26 @@ class UserController extends Controller
//Show littlelink page. example => http://127.0.0.1:8000/+admin
public function littlelink(request $request)
{
$littlelink_name = $request->littlelink;
$id = User::select('id')->where('littlelink_name', $littlelink_name)->value('id');
if(env('HOME_URL') !== ""){
$littlelink_name = env('HOME_URL');
$id = User::select('id')->where('littlelink_name', $littlelink_name)->value('id');
}else{
$littlelink_name = $request->littlelink;
$id = User::select('id')->where('littlelink_name', $littlelink_name)->value('id');
if (empty($id)) {
return abort(404);
}
$userinfo = User::select('id', 'name', 'littlelink_name', 'littlelink_description', 'theme', 'role')->where('id', $id)->first();
$information = User::select('name', 'littlelink_name', 'littlelink_description', 'theme')->where('id', $id)->get();
$links = DB::table('links')->join('buttons', 'buttons.id', '=', 'links.button_id')->select('links.link', 'links.id', 'links.button_id', 'links.title', 'links.custom_css', 'links.custom_icon', 'buttons.name')->where('user_id', $id)->orderBy('up_link', 'asc')->orderBy('order', 'asc')->get();
return view('littlelink', ['userinfo' => $userinfo, 'information' => $information, 'links' => $links, 'littlelink_name' => $littlelink_name]);
}
//Show littlelink page as home page if set in config
public function littlelinkhome(request $request)
{
$littlelink_name = env('HOME_URL');
$id = User::select('id')->where('littlelink_name', $littlelink_name)->value('id');
if (empty($id)) {
return abort(404);

View File

@ -60,7 +60,7 @@ if(config('advanced-config.custom_home_url') != '') {
$custom_home_page_url = "/home";
}
if(env('HOME_URL') != '') {
Route::get('/', [UserController::class, 'littlelink'])->name('littlelink');
Route::get('/', [UserController::class, 'littlelinkhome'])->name('littlelink');
if(config('advanced-config.disable_home_page') == 'redirect') {
Route::get($custom_home_page_url, function () {return redirect(config('advanced-config.redirect_home_page'));});
}elseif(config('advanced-config.disable_home_page') != 'true') {