Added option to set profile as homepage
The homepage can now be changed to a user's profile page with the option "HOME_URL" in the config (found on the Admin Panel under Admin>Config). This commit is a bit janky, I wanted to change the homepage with a setting saved in the database, but I couldn't finish this in time, so this has to do for now. An if statement in the web routes PHP checks if the new setting is present in the config and changes the homepage to the listed LittleLink Custom name. If the homage is changed, the page previously set as the homepage where users can register and or login can now be found at .../home.
This commit is contained in:
parent
4b9d39ce66
commit
89d54492fd
5
.env
5
.env
|
@ -8,6 +8,11 @@ NOTIFY_UPDATES=true
|
|||
DISPLAY_FOOTER=true
|
||||
DISPLAY_CREDIT=true
|
||||
|
||||
#Home URL=Changes if a user profile should be displayed as the homepage
|
||||
#=Leave empty to use the default homepage. To set your profile as the homepage, enter a LittleLink name. You can find this on the user panel under the page setting, the name is what comes after the '@'.
|
||||
#=(e.g. 'admin' without the '@')
|
||||
HOME_URL=
|
||||
|
||||
#App Settings=Changes settings regarding your LittleLink Custom installation. You probably only want to change the App Name setting.
|
||||
#=App_Name changes the displayed name for the App in the title, for example.
|
||||
APP_NAME="LittleLink Custom"
|
||||
|
|
|
@ -48,6 +48,24 @@ class UserController extends Controller
|
|||
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);
|
||||
}
|
||||
|
||||
$userinfo = User::select('name', 'littlelink_name', 'littlelink_description')->where('id', $id)->first();
|
||||
$information = User::select('name', 'littlelink_name', 'littlelink_description')->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', '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 buttons for add link
|
||||
public function showButtons()
|
||||
{
|
||||
|
|
|
@ -19,7 +19,10 @@ return [
|
|||
'currentEnv' => 'Current .env',
|
||||
],
|
||||
'currentEnv' => [
|
||||
'title' => 'Current .env file Content',
|
||||
'title' => '
|
||||
To be able to save values you see here PHP needs to be able to write to your current directory.
|
||||
Strings with a # in front of them are comments and wont affect anything.
|
||||
',
|
||||
'tableTitles' => [
|
||||
'key' => 'Key',
|
||||
'value' => 'Value',
|
||||
|
|
|
@ -17,6 +17,14 @@ use App\Http\Controllers\UserController;
|
|||
|
|
||||
*/
|
||||
|
||||
//Changes the homepage to a LittleLink Custom profile if set in the config
|
||||
if(env('HOME_URL') != '') {
|
||||
Route::get('/', [UserController::class, 'littlelinkhome'])->name('littlelink');
|
||||
Route::get('/home', [App\Http\Controllers\HomeController::class, 'home'])->name('home');
|
||||
} else {
|
||||
Route::get('/', [App\Http\Controllers\HomeController::class, 'home'])->name('home');
|
||||
}
|
||||
|
||||
//Redirect if no page URL is set
|
||||
Route::get('/@', function () {
|
||||
return redirect('/studio/no_page_name');
|
||||
|
@ -27,7 +35,6 @@ Route::get('/going/{id?}/{link?}', [UserController::class, 'clickNumber'])->wher
|
|||
Route::get('/+{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
|
||||
Route::get('/@{littlelink}', [UserController::class, 'littlelink'])->name('littlelink');
|
||||
Route::get('/pages/{name}', [AdminController::class, 'pages'])->name('pages');
|
||||
Route::get('/', [App\Http\Controllers\HomeController::class, 'home'])->name('home');
|
||||
|
||||
//User route
|
||||
Route::group([
|
||||
|
|
|
@ -8,6 +8,11 @@ NOTIFY_UPDATES=true
|
|||
DISPLAY_FOOTER=true
|
||||
DISPLAY_CREDIT=true
|
||||
|
||||
#Home URL=Changes if a user profile should be displayed as the homepage
|
||||
#=Leave empty to use the default homepage. To set your profile as the homepage, enter a LittleLink name. You can find this on the user panel under the page setting, the name is what comes after the '@'.
|
||||
#=(e.g. 'admin' without the '@')
|
||||
HOME_URL=
|
||||
|
||||
#App Settings=Changes settings regarding your LittleLink Custom installation. You probably only want to change the App Name setting.
|
||||
#=App_Name changes the displayed name for the App in the title, for example.
|
||||
APP_NAME="LittleLink Custom"
|
||||
|
|
Loading…
Reference in New Issue