Reverting form request because it doesn't seem to work (????!!)

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2021-12-08 17:54:15 -08:00
parent 8c1cd87831
commit 8fa690b635

View file

@ -22,6 +22,7 @@ use Input;
use Redirect;
use Response;
use App\Helpers\StorageHelper;
use App\Http\Requests\SlackSettingsRequest;
/**
* This controller handles all actions related to Settings for
@ -667,25 +668,12 @@ class SettingsController extends Controller
*
* @return View
*/
public function postSlack(Request $request)
public function postSlack(SlackSettingsRequest $request)
{
if (is_null($setting = Setting::getSettings())) {
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
$validatedData = $request->validate([
'slack_channel' => 'regex:/(?<!\w)#\w+/|required_with:slack_endpoint|nullable',
]);
if ($validatedData) {
$setting->slack_endpoint = $request->input('slack_endpoint');
$setting->slack_channel = $request->input('slack_channel');
$setting->slack_botname = $request->input('slack_botname');
}
if ($setting->save()) {
return redirect()->route('settings.index')
->with('success', trans('admin/settings/message.update.success'));