refactor: 🚚 renamed Settings Classes

This commit is contained in:
IceToast 2022-01-05 21:54:49 +01:00
parent 96f5f45b58
commit ac190ecd17
4 changed files with 10 additions and 11 deletions

View file

@ -6,7 +6,7 @@ use App\Models\Settings;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class InvoiceSettingsC
class Invoices
{
public $tabTitle = 'Invoice Settings';
public $invoiceSettings;
@ -23,7 +23,7 @@ class InvoiceSettingsC
'logo' => 'nullable|max:10000|mimes:jpg,png,jpeg',
]);
$values=[
$values = [
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
"SETTINGS::INVOICE:COMPANY_NAME" => "company-name",
"SETTINGS::INVOICE:COMPANY_ADDRESS" => "company-address",
@ -34,9 +34,9 @@ class InvoiceSettingsC
"SETTINGS::INVOICE:PREFIX" => "invoice-prefix"
];
foreach($values as $key=>$value){
foreach ($values as $key => $value) {
Settings::where('key', $key)->update(['value' => $request->get($value)]);
Cache::forget("setting" .':'. $key);
Cache::forget("setting" . ':' . $key);
}
@ -47,5 +47,4 @@ class InvoiceSettingsC
return redirect()->route('admin.settings.index')->with('success', 'Invoice settings updated!');
}
}

View file

@ -7,7 +7,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Session;
class LanguageSettingsC
class Language
{
public $tabTitle = 'Language Settings';
public $languageSettings;

View file

@ -1,4 +1,4 @@
@inject('Invoices', 'App\Classes\Settings\InvoiceSettingsC')
@inject('Invoices', 'App\Classes\Settings\Invoices')
@inject('Settings', 'App\Models\Settings')
<div class="tab-pane mt-3" id="invoice">

View file

@ -23,8 +23,8 @@ use App\Http\Controllers\TranslationController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use App\Classes\Settings\LanguageSettingsC;
use App\Classes\Settings\InvoiceSettingsC;
use App\Classes\Settings\Language;
use App\Classes\Settings\Invoices;
/*
|--------------------------------------------------------------------------
@ -133,8 +133,8 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () {
#settings
Route::patch('settings/update/icons', [SettingsController::class, 'updateIcons'])->name('settings.update.icons');
Route::patch('settings/update/invoice-settings', [InvoiceSettingsC::class, 'updateInvoiceSettings'])->name('settings.update.invoicesettings');
Route::patch('settings/update/language', [LanguageSettingsC::class, 'updateLanguageSettings'])->name('settings.update.languagesettings');
Route::patch('settings/update/invoice-settings', [Invoices::class, 'updateInvoiceSettings'])->name('settings.update.invoicesettings');
Route::patch('settings/update/language', [Language::class, 'updateLanguageSettings'])->name('settings.update.languagesettings');
Route::resource('settings', SettingsController::class)->only('index');
#invoices