aboutsummaryrefslogtreecommitdiff
path: root/app/Http
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http')
-rw-r--r--app/Http/Controllers/SpecialCallsController.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/Http/Controllers/SpecialCallsController.php b/app/Http/Controllers/SpecialCallsController.php
index 72da6b9..073bf6e 100644
--- a/app/Http/Controllers/SpecialCallsController.php
+++ b/app/Http/Controllers/SpecialCallsController.php
@@ -103,7 +103,22 @@ class SpecialCallsController extends Controller
public function addForm(Request $request)
{
- return Redirect::back();
+ $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();
+ }
+
+ $newcall = new SpecialCall();
+ $newcall->sign = strtoupper($request->sign);
+ $newcall->description = $request->description;
+ $newcall->saveOrFail();
+
+ return Redirect::back()->with('status', 'Callsign added.');
}
public function reservations(Request $request)