Turned ll home page into one function
This commit is contained in:
parent
03db2656ba
commit
b9c0b38260
|
@ -77,26 +77,14 @@ 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 (empty($id)) {
|
||||
return abort(404);
|
||||
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');
|
||||
}
|
||||
|
||||
$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);
|
||||
|
|
|
@ -60,7 +60,7 @@ if(config('advanced-config.custom_home_url') != '') {
|
|||
$custom_home_page_url = "/home";
|
||||
}
|
||||
if(env('HOME_URL') != '') {
|
||||
Route::get('/', [UserController::class, 'littlelinkhome'])->name('littlelink');
|
||||
Route::get('/', [UserController::class, 'littlelink'])->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') {
|
||||
|
|
Loading…
Reference in New Issue