fix: 🚑️ Icon uploading
This commit is contained in:
parent
cebc026d25
commit
e9e539c8c5
2 changed files with 19 additions and 43 deletions
|
@ -42,6 +42,9 @@ class System
|
|||
->withInput();
|
||||
}
|
||||
|
||||
// update Icons from request
|
||||
$this->updateIcons($request);
|
||||
|
||||
|
||||
$values = [
|
||||
"SETTINGS::SYSTEM:REGISTER_IP_CHECK" => "register-ip-check",
|
||||
|
@ -70,4 +73,20 @@ class System
|
|||
}
|
||||
return redirect(route('admin.settings.index') . '#system')->with('success', __('System settings updated!'));
|
||||
}
|
||||
|
||||
private function updateIcons(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg',
|
||||
'favicon' => 'nullable|max:10000|mimes:ico',
|
||||
]);
|
||||
|
||||
if ($request->hasFile('icon')) {
|
||||
$request->file('icon')->storeAs('public', 'icon.png');
|
||||
}
|
||||
|
||||
if ($request->hasFile('favicon')) {
|
||||
$request->file('favicon')->storeAs('public', 'favicon.ico');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,47 +40,4 @@ class SettingsController extends Controller
|
|||
'tabListItems' => $tabListItems,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function updatevalue(Request $request)
|
||||
{
|
||||
$setting = Settings::findOrFail($request->input('key'));
|
||||
|
||||
$request->validate([
|
||||
'key' => 'required|string|max:191',
|
||||
'value' => 'required|string|max:191',
|
||||
]);
|
||||
|
||||
$setting->update($request->all());
|
||||
|
||||
return redirect()->route('admin.settings.index')->with('success', __('configuration has been updated!'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Settings $setting
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Settings $setting)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function datatable()
|
||||
{
|
||||
$query = Settings::where('key', 'like', '%SYSTEM%')
|
||||
->orWhere('key', 'like', '%USER%')
|
||||
->orWhere('key', 'like', '%SERVER%');
|
||||
|
||||
return datatables($query)
|
||||
->addColumn('actions', function (Settings $setting) {
|
||||
return '<button data-content="' . __("Edit") . '" data-toggle="popover" data-trigger="hover" data-placement="top" onclick="configuration.parse(\'' . $setting->key . '\',\'' . $setting->value . '\',\'' . $setting->type . '\')" data-content="Edit" data-trigger="hover" data-toggle="tooltip" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></button> ';
|
||||
})
|
||||
->editColumn('created_at', function (Settings $setting) {
|
||||
return $setting->created_at ? $setting->created_at->diffForHumans() : '';
|
||||
})
|
||||
->rawColumns(['actions'])
|
||||
->make();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue