Unusage codes and files ejected

This commit is contained in:
Burak Civan
2021-05-29 17:01:22 +03:00
parent cb0fa5a804
commit 4c49095928
10 changed files with 19 additions and 299 deletions

View File

@ -16,10 +16,12 @@ class Settings extends Controller
{
use DateTime, Uploads;
public $skip_keys = ['company_id', '_method', '_token', '_prefix', 'uploaded_logo'];
public $skip_keys = ['company_id', '_method', '_token', '_prefix'];
public $file_keys = ['company.logo', 'invoice.logo'];
public $uploaded_file_keys = ['company.uploaded_logo', 'invoice.uploaded_logo'];
/**
* Show the form for editing the specified resource.
*
@ -95,6 +97,11 @@ class Settings extends Controller
continue;
}
// change dropzone middleware already uploaded file
if (in_array($real_key, $this->uploaded_file_keys)) {
continue;
}
// Process file uploads
if (in_array($real_key, $this->file_keys)) {
// Upload attachment
@ -113,6 +120,10 @@ class Settings extends Controller
}
if ($real_key == 'default.locale') {
if (!in_array($value, config('language.allowed'))) {
continue;
}
user()->setAttribute('locale', $value)->save();
}
@ -156,14 +167,14 @@ class Settings extends Controller
Installer::updateEnv(['MAIL_FROM_NAME' => '"' . $value . '"']);
break;
case 'company.email':
Installer::updateEnv(['MAIL_FROM_ADDRESS' => $value]);
Installer::updateEnv(['MAIL_FROM_ADDRESS' => '"' . $value . '"']);
break;
case 'default.locale':
Installer::updateEnv(['APP_LOCALE' => $value]);
Installer::updateEnv(['APP_LOCALE' => '"' . $value . '"']);
break;
case 'schedule.time':
Installer::updateEnv(['APP_SCHEDULE_TIME' => '"' . $value . '"']);
break;
}
}
}
}