fix: 🚑️ create settings db entries if not existing & moved settingsController out of folder
This commit is contained in:
parent
432be2f2d1
commit
881d3e4b45
6 changed files with 7 additions and 13 deletions
|
@ -39,7 +39,7 @@ class Invoices
|
|||
if (!$param) {
|
||||
$param = "";
|
||||
}
|
||||
Settings::where('key', $key)->update(['value' => $param]);
|
||||
Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]);
|
||||
Cache::forget("setting" . ':' . $key);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class Language
|
|||
if (!$param) {
|
||||
$param = "false";
|
||||
}
|
||||
Settings::where('key', $key)->update(['value' => $param]);
|
||||
Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]);
|
||||
Cache::forget("setting" . ':' . $key);
|
||||
Session::remove("locale");
|
||||
}
|
||||
|
@ -44,5 +44,4 @@ class Language
|
|||
|
||||
return redirect()->route('admin.settings.index')->with('success', 'Language settings updated!');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,13 +56,11 @@ class Misc
|
|||
if (!$param) {
|
||||
$param = "";
|
||||
}
|
||||
Settings::where('key', $key)->update(['value' => $param]);
|
||||
Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]);
|
||||
Cache::forget("setting" . ':' . $key);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('admin.settings.index')->with('success', 'Misc settings updated!');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,12 +41,11 @@ class Payments
|
|||
if (!$param) {
|
||||
$param = "";
|
||||
}
|
||||
Settings::where('key', $key)->update(['value' => $param]);
|
||||
Settings::where('key', $key)->updateOrCreate(['key' => $key], ['value' => $param]);
|
||||
Cache::forget("setting" . ':' . $key);
|
||||
}
|
||||
|
||||
|
||||
return redirect()->route('admin.settings.index')->with('success', 'Payment settings updated!');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\SettingsControllers;
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Settings;
|
||||
|
@ -69,8 +69,7 @@ class SettingsController extends Controller
|
|||
|
||||
public function datatable()
|
||||
{
|
||||
$query = Settings::
|
||||
where('key', 'like', '%SYSTEM%')
|
||||
$query = Settings::where('key', 'like', '%SYSTEM%')
|
||||
->orWhere('key', 'like', '%USER%')
|
||||
->orWhere('key', 'like', '%SERVER%');
|
||||
|
||||
|
@ -84,5 +83,4 @@ class SettingsController extends Controller
|
|||
->rawColumns(['actions'])
|
||||
->make();
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@ use App\Http\Controllers\Admin\PaymentController;
|
|||
use App\Http\Controllers\Admin\CreditProductController;
|
||||
use App\Http\Controllers\Admin\ProductController;
|
||||
use App\Http\Controllers\Admin\ServerController as AdminServerController;
|
||||
use App\Http\Controllers\Admin\SettingsControllers\SettingsController;
|
||||
use App\Http\Controllers\Admin\SettingsController;
|
||||
use App\Http\Controllers\Admin\UsefulLinkController;
|
||||
use App\Http\Controllers\Admin\UserController;
|
||||
use App\Http\Controllers\Admin\VoucherController;
|
||||
|
|
Loading…
Reference in a new issue