aboutsummaryrefslogtreecommitdiff
path: root/app/Http
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http')
-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.');
+ }
}