aboutsummaryrefslogtreecommitdiff
path: root/app/Http/Controllers
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2020-11-01 18:38:02 +0100
committerMateja <mail@matejamaric.com>2020-11-01 18:38:02 +0100
commit8fee1d776d8f2f538968b1d761dfbbfd3e52ae27 (patch)
tree7c958ac82840a278236ec6dda81131e38a52a42e /app/Http/Controllers
parent0ce5bbcc443b9da12e5233a481f2ef15017ee891 (diff)
downloadyota-laravel-8fee1d776d8f2f538968b1d761dfbbfd3e52ae27.tar.gz
yota-laravel-8fee1d776d8f2f538968b1d761dfbbfd3e52ae27.zip
Editing signs buggy...
Diffstat (limited to 'app/Http/Controllers')
-rw-r--r--app/Http/Controllers/SpecialCallsController.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/Http/Controllers/SpecialCallsController.php b/app/Http/Controllers/SpecialCallsController.php
index 073bf6e..3d6f2b9 100644
--- a/app/Http/Controllers/SpecialCallsController.php
+++ b/app/Http/Controllers/SpecialCallsController.php
@@ -131,4 +131,30 @@ class SpecialCallsController extends Controller
{
return Redirect::back();
}
+
+ public function edit(Request $request, int $id)
+ {
+ $data = SpecialCall::findOrFail($id);
+ return view('pages.editsign', compact('data'));
+ }
+
+ public function editForm(Request $request, int $id)
+ {
+ $rules = [ 'sign' => 'required' ];
+ $messages = [ 'sign.required' => 'You need to provide a callsign!' ];
+ $validator = Validator::make($request->all(), $rules, $messages);
+
+ if ($validator->fails()) {
+ return Redirect::back()
+ ->withErrors($validator)
+ ->withInput();
+ }
+
+ $data = SpecialCall::findOrFail($id);
+ $data->sign = strtoupper($request->sign);
+ $data->description = $request->description;
+ $data->saveOrFail();
+
+ return Redirect::back()->with('statusE', 'Callsign edited.');
+ }
}