mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-21 13:23:04 +01:00
Added setting for app name
This commit is contained in:
@@ -91,6 +91,11 @@ class SettingsHelper
|
||||
*/
|
||||
public static function settingIsEditable(string $key)
|
||||
{
|
||||
// Manual override for app_name
|
||||
if ($key === 'app_name') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
// Try exact key
|
||||
@@ -139,6 +144,7 @@ class SettingsHelper
|
||||
{
|
||||
return [
|
||||
'base' => SettingsHelper::getBase(),
|
||||
'name' => SettingsHelper::get('app_name')->value,
|
||||
'widgets' => [
|
||||
'show_average' => (bool)SettingsHelper::get('show_average')->value,
|
||||
'show_max' => (bool)SettingsHelper::get('show_max')->value,
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use App\Helpers\SettingsHelper;
|
||||
use App\Setting;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAppNameSetting extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!SettingsHelper::get('app_name')) {
|
||||
Setting::create([
|
||||
'name' => 'app_name',
|
||||
'value' => 'Speedtest Tracker',
|
||||
'description' => 'Set a custom app name'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Setting::whereIn('name', [
|
||||
'app_name',
|
||||
])->delete();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,6 @@ Route::get(SettingsHelper::getBase() . 'files/{path?}', function($file) {
|
||||
->name('files');
|
||||
|
||||
Route::get('/{path?}', function () {
|
||||
return view('app', [ 'title' => 'Speedtest Tracker' ]);
|
||||
return view('app', ['title' => SettingsHelper::get('app_name')->value]);
|
||||
})->where('path', '^((?!\/api\/).)*$')
|
||||
->name('react');
|
||||
|
||||
Reference in New Issue
Block a user