Unusage codes and files ejected
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user