Added error messages to settings.blade.php

This commit is contained in:
Miguel Nogueira 2020-08-31 19:50:58 +01:00
parent 2afea88846
commit 41e3e817a2
2 changed files with 11 additions and 2 deletions

View File

@ -40,13 +40,16 @@ class OptionsController extends Controller
} }
catch(\Exception $ex) catch(\Exception $ex)
{ {
$errorCond = true;
$request->session()->flash('error', 'An error occurred while trying to save settings: ' . $ex->getMessage()); $request->session()->flash('error', 'An error occurred while trying to save settings: ' . $ex->getMessage());
exit;
} }
} }
if (!isset($errorCond))
{
$request->session()->flash('success', 'Settings saved successfully!'); $request->session()->flash('success', 'Settings saved successfully!');
} }
}
else else
{ {
$request->session()->flash('error', 'You do not have permission to update this resource.'); $request->session()->flash('error', 'You do not have permission to update this resource.');

View File

@ -20,6 +20,12 @@
</script> </script>
@endif @endif
@if (session()->has('error'))
<script>
toastr.error("{{session('error')}}")
</script>
@endif
@if($errors->any()) @if($errors->any())
@foreach ($errors->all() as $error) @foreach ($errors->all() as $error)
<script>toastr.error('{{$error}}', 'Validation error!')</script> <script>toastr.error('{{$error}}', 'Validation error!')</script>